Reputation: 183
I'm trying to use VideoCapture in my OpenCV native application. To construct my application I followed instructions released with OpenCV2.3.1 release, so I have an Android.mk file to build my app and a Builder in eclipse to do it directly from eclipse. Everything works fine, compiling and linking other openCV modules, but when I use VideoCapture I get a linking error like this:
SharedLibrary : liblivecamera.so C:/Development/android-opencv-wsp/VideoCamLibAndroid_v0.1/obj/local/ armeabi-v7a/libopencv_highgui.a(cap_android.o): In function
CvCapture_Android::convertYUV2BGR(int, int, unsigned char const*, cv::Mat&, bool, bool)': cap_android.cpp: (.text._ZN17CvCapture_Android14convertYUV2BGREiiPKhRN2cv3MatEbb *+0x1c6): undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' cap_android.cpp: (.text._ZN17CvCapture_Android14convertYUV2BGREiiPKhRN2cv3MatEbb +0x1f8): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' collect2: ld returned 1 exit status make: * [/cygdrive/c/Development/android-opencv-wsp/ VideoCamLibAndroid_v0.1/obj/local/armeabi-v7a/liblivecamera.so] Error 1*
If I use opencv2.3.0 I can make it work (compiling with CMake), but I really need to use OCV2.3.1 and its new functionality.
Has anyone successfully used VideoCapture module with OpenCV2.3.1?
Upvotes: 2
Views: 2149
Reputation: 8090
I had the exact same problem and after bashing my head against the wall for several hours I finally found a solution !
Apparently, There is an error in the OpenCV.mk
provided with the OpenCV 2.3.1.
The following line:
OPENCV_MODULES := contrib calib3d objdetect features2d video imgproc highgui ml legacy flann core
Should be replaced with:
OPENCV_MODULES := contrib legacy objdetect calib3d features2d video highgui ml imgproc flann core
It looks very similar but there is a slight difference if you look at the order of the modules.
You can understand the logic of this change by taking a look at the OpenCVConfig.cmake
file which states as follows:
#libraries order is very important because linker from Android NDK is one-pass linker
If it's so important why wasn't it included in the original OpenCV.mk
?????
Upvotes: 3