OpenCV/Android 编译错误

发布于 2024-11-17 09:59:32 字数 1194 浏览 1 评论 0原文

我目前正在关注本教程(http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Windows.pdf),了解如何在 Windows 中设置 OpenCV for Android 和我有一些我不明白的错误。基本上,在步骤 3.c 中,当我使用命令“make”在 Cygwin 中编译 OpenCV 库时,我收到这些错误;

/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] Error 2 

提前感谢您的帮助,

拉尔夫。

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] Error 2 

Thank you for your help in advance,

Ralph.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

凉栀 2024-11-24 09:59:32

calibfilter.cpp 和 epilines.cpp 的顶部都有一个“#undefquad”。如果我注释掉这些undef,它就会成功编译。

对于我的一生,我无法弄清楚为什么那里有一个 undef...也许导入的顺序是错误的或者其他什么。

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.

如痴如狂 2024-11-24 09:59:32

我遇到了同样的问题。查看/home/Ralph/opencv/modules/legacy/include/opencv2/legacy/legacy.hpp,结构定义是:

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;

我完全困惑为什么它似乎没有work:quad 就在那里定义的。

通过注释 calibfilter.cppepilines.cpp 中引用 quad 属性的所有行,我至少设法让 OpenCV 编译,但是这个毫无疑问打破了立体摄像头的支持。

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.

舂唻埖巳落 2024-11-24 09:59:32

在 Windows 上安装 OpenCV 很容易。

请按照以下步骤操作。

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

您提到的链接不使用支持的官方NDK 谷歌。过去我在配置和使用 ndk4 时遇到了麻烦。

如果使用或不使用 ndk4 对您来说并不重要,官方链接(使用 NDK 5)就可以正常工作。尝试一下。它们的步骤大多相同。

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

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

往日 2024-11-24 09:59:32

正如 @Matthew Hemke 所写,#undef 是罪魁祸首。这很奇怪,因为代码编译得很好,就像在 Ubuntu 中一样,但是当我在 Cygwin 下(在 windows-7 上)编译 OpenCV 时遇到类似的“No member Quad”错误时。这里肯定缺少一些基本的东西。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文