Ask Your Question

OpenCV + Swift 2 + CvVideoCameraDelegate

asked 2015-08-18 19:45:16 -0500

easchimidt gravatar image

Hello guys,

I've been studying OpenCV for the last couple of weeks.

I'm developing a project using OpenCV 3, Swift 2, iOS 9. It needs real time camera image acquisition.

I've followed several tutorials in internet (even in japanese, using translator!). But I couldn't use the CvVideoCameraDelegate in the project :/

My Objective C++ wrapper header (called Camera.h) must implement the CvVideoCameraDelegate. But, to be able to know it, I need to include the file opencv2/videoio/cap_ios.h. The image below shows my project and this header file:

image description

My bridge file it only contains this wrapper header (called Camera.h).

image description

But, when I try to build, some errors occurs: Core.hpp/Base.hpp header must be compiled as C++; climits not found.

image description

This happens because the cap_ios.h is inside the .h header. If I don't use the delegate, and include the cap_ios.h only in the .mm, there is no problem.

Well, does anybody knows how to handle this?

Thanks for your support. If there is questions about the problem, please ask.

edit retag flag offensive close merge delete


Hey, I'm just working on my company on the same thing, is there a way we could talk? if yes - my mail is oded [at] mdalgorithms [dot] com

oded gravatar imageoded ( 2016-05-24 10:21:26 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-08-21 07:41:47 -0500

easchimidt gravatar image

Hello guys,

I've achieved to make it work, but, to do that, unfortunatelly I had to use the version 2.4.11 of OpenCV. I don't know why the OpenCV 3 version do not work. The only adjustment I had to do is change the include in Camera.h from opencv2/videio/cap_ios.h to highgui/cap_ios.h, the old location of cap_ios.h header.

Does anybody know (or have any clue) why it don't work with OpenCV 3?


edit flag offensive delete link more


I was using the pod but it didn't do anything I think there is a lot more involve that just using cocoapods. I can't even find the bridging header file with the cocoapods

IOSDev gravatar imageIOSDev ( 2016-01-05 03:02:31 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2015-08-18 19:45:16 -0500

Seen: 2,532 times

Last updated: Aug 21 '15