0

I am trying to integrate QT5.2.0 beta 1 in win7 (32b) with opencv and android for native c++ development. unfortunately I couldn't succeed. (Additionally I tried necessitas too but no luck.) Application works on desktop but when I try to compile for android kits (x86 or arm7s) I get errors related to "lopencv_highgui.a" during build such as

"C:/OpenCV-2.4.6-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_highgui.a(grfmt_exr.cpp.o): In function cv::ExrDecoder::ExrDecoder()':grfmt_exr.cpp:(.text._ZN2cv10ExrDecoderC2Ev+0x82): undefined reference toImf::Chromaticities::Chromaticities(Imath::Vec2 const&, Imath::Vec2 const&, Imath::Vec2 const&, Imath::Vec2 const&)'"

I used a clear setup with couple of NDKs (r8b, r8e, r9) versions with

  • "C:\adt-bundle-windows-x86-20130917" (managed APIs 16, 17, 18)
  • "C:\apache-ant-1.9.2\bin\ant.bat"
  • "C:\Program Files (x86)\Java\jdk1.7.0_45" (Set the JAVA_HOME in system env. vars.)
  • "C:\OpenCV-2.4.6-android-sdk" & ""C:\OpenCV-2.4.6"
  • "C:\Qt\Qt5.2.0\5.2.0-beta1\mingw48_32" (QTDIR in sys.env.vars.)

I tried following solutions

  • I reordered the opencv libs in pro file as defined.
  • I checked the existence of the sh.exe (not exists)
  • I copied tools.jar from jdk to the "C:\Program Files (x86)\Java\jre7\lib" folder

I used Genymotion for virtual android environment with NEXUS S 4.2.2 x86 (API17) & Galaxy Nexus 4.1.1 x86 (API16).

I can compile, deploy and run some Qt examples on emulator (no Opengls and without opencv) but I couldn't get any success on simple opencv application. (PS: the application is working on desktop )

I think I need a simple running Qt opencv android example with the correct pro, user and other configurations to find the right solution and defines the errors.

Could anyone may share a working sample?

Frank Osterfeld
  • 24,815
  • 5
  • 58
  • 70
  • Add your .pro file. All that deployment information is irrelevant for this question. (as you're getting stuck during building) – Frank Osterfeld Oct 29 '13 at 05:00
  • you can download the project from the following link: https://dl.dropboxusercontent.com/u/69950201/simpleCV.zip – Dogan Turkuler Oct 29 '13 at 19:34
  • You're asking too much from stackoverflow readers :) Add the relevant bits to the post. – Frank Osterfeld Oct 29 '13 at 19:45
  • Dear Frank, I tried to paste the pro file contents but comment field is not accept the size, so I included it into the zip file (with the project) and attached the link. Is there any other way to paste the contents? I also uploaded the pro to pastebin --> http://pastebin.ca/2472563 – Dogan Turkuler Oct 29 '13 at 20:35
  • possible duplicate of [How to integrate OpenCV into Qt Creator Android project](http://stackoverflow.com/questions/27562311/how-to-integrate-opencv-into-qt-creator-android-project) – sashoalm Dec 19 '14 at 08:47

1 Answers1

0

The problem occurs due to a missing library definition in the pro file (libIlmImf.a).

corrected libraries definition in pro file is as follows:

ANDROID_OPENCV = C:/OpenCV-2.4.6-android-sdk/sdk/native
LIBS += \
$$ANDROID_OPENCV/libs/x86/libopencv_contrib.a \
$$ANDROID_OPENCV/libs/x86/libopencv_legacy.a \
$$ANDROID_OPENCV/libs/x86/libopencv_ml.a \
$$ANDROID_OPENCV/libs/x86/libopencv_objdetect.a \
$$ANDROID_OPENCV/libs/x86/libopencv_calib3d.a \
$$ANDROID_OPENCV/libs/x86/libopencv_video.a \
$$ANDROID_OPENCV/libs/x86/libopencv_features2d.a \
$$ANDROID_OPENCV/libs/x86/libopencv_highgui.a \
$$ANDROID_OPENCV/libs/x86/libopencv_androidcamera.a \
$$ANDROID_OPENCV/libs/x86/libopencv_flann.a \
$$ANDROID_OPENCV/libs/x86/libopencv_imgproc.a \
$$ANDROID_OPENCV/libs/x86/libopencv_core.a \
$$ANDROID_OPENCV/3rdparty/libs/x86/libIlmImf.a \
$$ANDROID_OPENCV/3rdparty/libs/x86/liblibpng.a \
$$ANDROID_OPENCV/3rdparty/libs/x86/liblibtiff.a \
$$ANDROID_OPENCV/3rdparty/libs/x86/liblibjpeg.a \
$$ANDROID_OPENCV/3rdparty/libs/x86/liblibjasper.a \
$$ANDROID_OPENCV/3rdparty/libs/x86/libtbb.a
  • (But another problem is occurred when running in android emulator caused by "shader program is not linked". I am still working on that but this is another question's issue)
  • EDIT: I solved the problem of "shader program is not linked" by switching the emulator from GenyMotion to AVD (NEXUS S, API17, w/o googleapi, x86) and setting the "Use Host GPU" flag and adding the CONFIG+= opengl to pro file