QT using OpenCV and camera with mobile phone
-
Hi, I want to make a mobile app witch uses the camera from the mobile phone and the OpenCV library for processing tasks on the gathered images. I am working on an MacBook Air with macOS Sierra version 10.12.2.
I actually want to test my applications on the computer by using the webcam. And if the application works, than let the application run on the mobile simulator, than the device.
For setting up OpenCV in OS X i used the following tutorial.
It works fine and I also have access to my webcam an can use it. But if I want to build it for my mobile application, it sais: 'opencv development package not found'
Also I have the question if there is a tutorial or a guide somewhere, where I can find how to set up my application, so it runs on the OS X with the webcam and on IOS, or any other mobile device, with the camera?
-
@Domididongo said in QT using OpenCV and camera with mobile phone:
It works fine and I also have access to my webcam an can use it. But if I want to build it for my mobile application, it sais: 'opencv development package not found'
You need to install OpenCV for Android / iOS. Depend on where you got the library, it may not come with pkg-config, so probably you need to setup the library per platform.
-
How can I set up different library bindings in qmake?
-
You can add configuration blocks to the .pro file of your project for platform-specific settings, e.g. like this:
android { # put settings here for Android configuration } ios { # put settings here for iOS configuration }
You can use this feature to link different libraries for each platform (there are also conditions for other platforms, e.g. win32, macx, ...)
Best,
GT -
I have now added this:
osx{
INCLUDEPATH += /usr/local/Cellar/opencv3/3.2.0/include/
LIBS += -L/usr/local/Cellar/opencv3/3.2.0/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_flann -lopencv_features2d -lopencv_imgcodecs -lopencv_ml -lopencv_video -lopencv_videoio
}ios{
LIBS +=
-F /usr/local/Frameworks/ios
-framework opencv2}
for the OS X part it works fine. But for the IOS it tells me:
.../opencv2 does not contain bitcode.Your must rebuild it with bitcode enabled (Xcode setting EBALE_BITCODE).I tried to open the gilded Xcode project and set the Enable Bitcode to NO. But it won't help
-
Hi,
Did you compile OpenCV for iOS ?
-
I builded the framework like it was said here.
-
Which version of Xcode are you using ?
-
I am using Xcode version 8.2.1 and cmake version 3.6.2
-
cmake or qmake ?
-
cmake! for building the framework. The QT version I am using is QT5.8.0
-
Ok
As for the bitcode problem, I'd modify their python script to ensure that it's building with bitcode enabled.
-
I looked in the '.../opencv/platforms/ios/build_framework.py' file. But which line should I change to enable Bitcode.
In line 47 is the class Builder, if I change 'self.bitcodedisabled = bitcodedisabled' to 'self.bitcodedisabled = 0' should that work?
-
@Domididongo said in QT using OpenCV and camera with mobile phone:
self.bitcodedisabled = 0
self.bitcodedisabled = False
-
So I changed now in line 276:
parser.add_argument('--disable-bitcode', default=False, dest='bitcodedisabled', action='store_false', help='disable bitcode (enabled by default)')the action='store_true' to action='store_false',
and in line 58:
self.bitcodedisabled = bitcodedisabled to self.bitcodedisabled = Falsebut still getting the same error:
does not contain bitcode...is there somewhere else something i have to change?
-
Try adding
set(CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE "bitcode")
to the iOS.cmake file.