开发者

OpenCV/Android compilation errors

I am currently following this tutorial (http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Windows.pdf) on how to set up OpenCV for Android in Windows and I am having some errors that I do not understand. Basically, at the step 3.c, when I compile the OpenCV libraries in Cygwin using the command “make”, I get these errors;

/home/Ralph/opencv/modules/legacy/src/calibfilter.cpp: In member function `virtual bool CvCalibFilter::SaveCameraParams(const char*)':
/home/Ralph/opencv/modules/legacy/src/calibfilter.cpp:693: error: `struct CvStereoCamera' has no member named `quad'
/home/Ralph/opencv/modules/legacy/src/calibfilter.cpp:694: error: `struct CvStereoCamera' has no member named `quad'
/home/Ralph/opencv/modules/legacy/src/calibfilter.cpp: In member function `virtual bool CvCalibFilter::LoadCameraParams(const char*)':
/home/Ralph/opencv/modules/legacy/src/calibfilter.cpp:749: error: `struct CvStereoCamera' has no member named `quad'
/home/Ralph/opencv/modules/legacy/src/calibfilter.cpp:750: error: `struct CvStereoCamera' has no member named `quad'
make[2]: *** [modules/legacy/CMakeFiles/opencv_legacy.dir/src/calibfilter.o] Error 1
make[1]: *** [modules/legacy/CMakeFiles/opencv_legacy.dir/all] Error 2
make: *** [all] Erro开发者_Go百科r 2 

Thank you for your help in advance,

Ralph.


There is an "#undef quad" at the top of both calibfilter.cpp and epilines.cpp. If I comment out these undefs, it succeeds in compiling.

For the life of me I can't figure out why there is an undef there... maybe the order of imports is wrong or something.


I've run into the same problem. Looking into /home/Ralph/opencv/modules/legacy/include/opencv2/legacy/legacy.hpp, the struct definition is:

typedef struct CvStereoCamera
{
    CvCamera* camera[2]; /* two individual camera parameters */
    float fundMatr[9]; /* fundamental matrix */

    /* New part for stereo */
    CvPoint3D32f epipole[2];
    CvPoint2D32f quad[2][4]; /* coordinates of destination quadrangle after
                                epipolar geometry rectification */
    double coeffs[2][3][3];/* coefficients for transformation */
    CvPoint2D32f border[2][4];
    CvSize warpSize;
    CvStereoLineCoeff* lineCoeffs;
    int needSwapCameras;/* flag set to 1 if need to swap cameras for good reconstruction */
    float rotMatrix[9];
    float transVector[3];
} CvStereoCamera;

I'm completely puzzled as to why it then doesn't appear to work: quad is defined right there.

By commenting all lines in calibfilter.cpp and epilines.cpp that reference the quad attribute, I managed to get OpenCV at least compiling, but this has no doubt broken the stereo camera support.


Installing OpenCV on Windows is easy.

Follow these steps.

http://www.developerstation.org/2011/02/using-opencv-21-on-visual-studio-2008.html

The link that you've mentioned doesn't use the official NDK supported by Google. I've had trouble in configuring and working with ndk4 in the past.

If working or not working with ndk4 doesn't matter to you, the official links (with NDK 5) work just fine. Give them a try. They are mostly the same steps.

http://opencv.itseez.com/doc/tutorials/introduction/android_binary_package/android_binary_package.html

http://opencv.itseez.com/doc/tutorials/introduction/android_binary_package/android_binary_package_using_with_NDK.html


As @Matthew Hemke wrote, that #undef is the culprit. Which is strange b'coz the code compiles fine , as it is in Ubuntu, but when I faced similar error of 'No member Quad', while compiling OpenCV under Cygwin (on windows-7). There sure is something fundamental missing here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜