Ask Your Question
0

How to integrate opencv in Xcode project-swift2/ios9

asked 2015-12-23 07:09:40 -0500

Hello, I'm a newbie at opencv. I needed a feature for face detection into my app, so after some search i found opencv was what i was looking for. I checked the documentation and tutorials, but there s not really much on how to integrate the framework into xcode(step by step tutorial). I ve checked even outside of forum, but no luck. Any help is appreciated, link/tutorial/documentation i could have missed. Thanks a lot in advance !

edit retag flag offensive close merge delete

Comments

sturkmen gravatar imagesturkmen ( 2015-12-23 16:27:43 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-12-23 14:46:01 -0500

jmbapps gravatar image

I could not get the new opencv framework to work, 3.0. I use 2.4.7. Drag it into your project, make sure "Copy Files" is checked. You must disable bitcode for it to work. I would suggest using Apples Face Detection, simpler, imo.

edit flag offensive delete link more

Comments

I have to compare an image i pick from iOS lib(or from camera) and compare it with other images. Based on this comparing, app will have a different output. Anyway i downloaded opencv 3.1 and opencv 2 framework. Dont i have to create any bridge-header file?

Siideffect gravatar imageSiideffect ( 2015-12-23 15:38:23 -0500 )edit

That is a good question. All my projects are a couple of years old and I had to add some code

ifdef __cplusplus

import <opencv2 opencv.hpp="">

endif

the the pre-compiled header or .pch file. Ive just been leaping the hurdles Apple keeps placing in my path. I have several new apps in the making but have other hobbies that are demanding more of my time. I will try to build a new sample project with opencv and post results here. Disregard the ="" You also need to change the .m files to .mm.

jmbapps gravatar imagejmbapps ( 2015-12-24 10:54:42 -0500 )edit

You have to use a bridging header file. Swift does not work with C++. I havent learned Swift. I am sick of Apple kicking the legs out from under their developers and this is a prime example. Im not going to learn another programming language that only applies to one manufacturer. Good luck trying to keep up with Apple. Deprecated methods....new languages that only THEY use. When you do figure it all out, be prepared to have to do it all over again in about 6 months when the new operating system comes out.

jmbapps gravatar imagejmbapps ( 2015-12-27 10:27:56 -0500 )edit

I understand your point of view but swift is now open source and is a very popular language. I don't really think will happen like with objective c , swift is clean language, easy to learn, it has not been made to be replaced in some year in my opinion. Anyway thank you for reply, i think I'm gonna leave this feature as the internet doesn't offer any(updated) tutorial

Siideffect gravatar imageSiideffect ( 2015-12-29 04:08:42 -0500 )edit

Making it open source is a strategy to build interest. Everything Apple does is for monetary gain. If this was the only hurdle in the past couple years then I would learn Swift. Sorry for the rant and I wish you much success. It is like the Dev Certs. I was iOS only, then this year they throw in the Mac Cert for free. Apple gives nothing away, so this tells me they are trying to peak interest in Mac developing, since everyone wants to be an iPhone developer. For me, iPad sales are almost double what my iPhone sales are. I make actual tools that people can use. I cannot and will not target people with useless games designed to constantly pry money from them with inApp purchases. That is not helping humanity, it is stealing, imo. Again sorry for the rant. Good luck!

jmbapps gravatar imagejmbapps ( 2016-01-01 10:16:23 -0500 )edit

I have completed a test project in Xcode using opencv 3.1. El Capitan 10.11.3, Xcode 7.2. No Swift yet, but I believe it will work. Works fine with Obj C.

jmbapps gravatar imagejmbapps ( 2016-01-27 13:41:55 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-12-23 07:09:40 -0500

Seen: 1,468 times

Last updated: Dec 23 '15