openframeworks/openFrameworks — pull request #1464 by bostonbusmap (2012-08-06 05:01:13+00:00)
Title: Android OpenCV libs don't match header files

When I was experimenting around with ofxCv I ran some of the examples with optical flow. It worked for the linux build, but when I tried it for android I got this error during the link step:

obj/androidRelease/addons/ofxCv/libs/ofxCv/src/Calibration.o: In function `ofxCv::Calibration::updateUndistortion()':
Calibration.cpp:(.text+0x1bdc): undefined reference to `cv::getOptimalNewCameraMatrix(cv::_InputArray const&, cv::_InputArray const&, cv::Size_, double, cv::Size_, cv::Rect_*, bool)'
obj/androidRelease/addons/ofxCv/libs/ofxCv/src/Flow.o: In function `ofxCv::FlowPyrLK::calcFlow()':
Flow.cpp:(.text+0xe78): undefined reference to `cv::calcOpticalFlowPyrLK(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::Size_, int, cv::TermCriteria, double, int, double)'
collect2: ld returned 1 exit status
make[1]: *** [libs/armeabi/libOFAndroidApp.so] Error 1
make[1]: Leaving directory `/home/schneg/Projects/openFrameworks/examples/android/restructor'
make: *** [AndroidRelease] Error 2

I used c++filt to get a list of functions and their arguments from the library files. Both functions are defined in the header file with an extra argument which isn't shown in the library files themselves. To fix I replaced the existing library files with ones from the 2.3.1 OpenCV binary download