繁体   English   中英

OpenCV无法编译

[英]OpenCV can't compile

我是新手OpenCV用户。 我只是想学习一些东西,但我不知道从哪里开始。

不幸的是,我可以找到很多有关openCV的教程,但是它们对我不起作用(有时是因为它们使用的是旧版本)。

因此,在真正开始之前,我想了解一下环境是否工作正常,以避免将来浪费时间。 这是我发现的一个示例:

#include <opencv\cv.h>
#include <opencv\highgui.h>

using namespace cv;

int main()
{
    //create an image to store the video screen grab
    Mat image;

    //setup the video capture method using the default camera
    VideoCapture cap;
    cap.open(0);

    //create the window that will show the video feed
    namedWindow("VideoCaptureTutorial", 1);

    //create a loop to update the image with video camera image capture
    while(1)
    {
        //grad a frame from the video camers
        cap>>image;

        //show the image on the screen
        imshow("VideoCaptureTutorial", image);

        //create a 33ms delay
        waitKey(33);
    }

    return 0;
}

我尝试编译(Visual Studio 2010),但出现类似150-250的错误。 我是Visual Studio的新手,我不太了解“他”和他“不喜欢”什么。 我正在学习如何在IDE中移动,但很难。

该错误涉及imgproc.hpp miniflann.hpp photo.hpp tracking.hpp,并报告许多未定义的标识符和语法错误。

我有一些编程经验(使用Arduino,Java,Assembly进行编程),但是我发现openCV文档非常令人困惑和困惑。 我是自学成才的,所以对入门的任何帮助将不胜感激,我的目标是在我的2WD机器人中实现Coputer视觉(如果可能,则为立体声)。

谢谢

告诉您如何使程序正常工作是不可能的,因为您几乎没有提供任何有助于理解问题原因的信息。 但是在阅读了以下几行之后:

我可以找到很多有关openCV的教程,但它们对我不起作用(有时是因为使用的是旧版本)

我是Visual Studio的新手,我不太了解“他”和他“不喜欢”什么。 我正在学习如何在IDE中移动,但很难。

我建议您看一下这些材料(由科罗拉多矿业大学计算机视觉的 William Hoff教授创建):
在Microsoft Visual C ++
在Microsoft Visual C ++中使用OpenCV

另请注意,OpenCV的二进制形式特定于Visual Studio的具体版本。 因此,例如,如果您有... \\ OpenCV \\ build \\ x86 \\ vc10 ,则意味着它应与Visual Studio 2010一起使用。 我最近在Visual Studio 2012中使用了OpenCV,必须自己编译。

假设您已在PC上正确安装了OpenCV并按需设置了IDE,则需要在代码中包含更多库...尝试将其添加到代码的顶部(我有OpenCV 3.1版和此代码为我工作...我也是新手!)

#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM