c++ - OpenCV无法编译

标签 c++ visual-studio-2010 visual-c++ opencv compiler-errors

我是新手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视觉(如果可能,则为立体声)。

谢谢

最佳答案

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

I can find a lots of tutorials about openCV but they doesn't work for me (sometime because of the old version they used)

I'm new to Visual Studio and I can't understand really well "him" and what he "doesn't like". I'm learning how to move inside the IDE but's its hard.



我建议您看一下这些 Material (由科罗拉多矿业大学计算机视觉的William Hoff教授创建):
Creating Your First Program in Microsoft Visual C++
Using OpenCV in Microsoft Visual C++

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

关于c++ - OpenCV无法编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15463455/

相关文章:

c++ - 为什么这个 Boost Spirit 示例没有编译?

visual-studio-2010 - 为什么发布到 Azure 时 IntalliTrace 选项呈灰色?

c++ - WinAPI 函数 LoadLibrary() 导致函数在执行错误期间失败

c++ - Visual C++ 2012 中的编译器错误? (乱七八糟的跳转地址)

c++ - VC++ 2012 中出乎意料的模棱两可的重载解析

c++ - 如何从参数包构造引用的 std::tuple?

c# - 将 BSTR 从 native c++ 传递到托管 c# dll 时出现问题

c++ - 如何在 IDL 中声明 IN、OPTIONAL 参数以及 OUT、RETVAL 参数

visual-studio-2010 - 使用 PowerShell 修改 Visual Studio 解决方案和项目文件

c# - Crystal 报表 (C#) : Informations not displaying correctly