Video processing with IOS + Swift

asked 2016-05-24 05:32:47 -0500

oded gravatar image

updated 2016-05-24 07:32:21 -0500

I've integrated opencv in Swift IOS project using bridging header (to connect Swift to Objective C) and a Objective C wrapper (to connect Objective C to C++). Using this method I can pass single images from the Swift code, analyse them in the C++ files and get them back.

I've seen that opencv provides CvVideoCamera object that can be integrated with an Objective C UIViewController.

But since my UIViewController are written in Swift I've wondered if this is possible as well?

edit retag flag offensive close merge delete


No. Swift does not like C++. Add a C++ file to your project and import and use opencv there. I had to set opencv up this way with iOS 9, or it wouldnt work.

jmbapps gravatar imagejmbapps ( 2016-05-24 07:08:31 -0500 )edit

I've already integrated opencv into my Swift app with C++ files and have analysis working on Single image. The question is if it's possible also on a video ? Because I saw that CvVideoCamera should be used in UIViewController (which is written in Swift in my case).

oded gravatar imageoded ( 2016-05-24 07:25:54 -0500 )edit

Did you change the .m file to a .mm? I dont use any sort of Wrapper, and I believe it is due to the .mm alerting the compiler that there is some C++ code. Not sure if UIVC is the best choice....GLKView maybe and CVPIxelBuffer?

jmbapps gravatar imagejmbapps ( 2016-05-25 08:16:09 -0500 )edit