0

我是新手 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 并报告许多未定义的标识符和语法错误。

我有一些编程经验(C 与 Arduino、Java、Assembly),但我发现 openCV 文档非常混乱和困惑。我是自学成才的,所以任何关于如何开始的帮助都将不胜感激,我的目标是在我的 2WD 机器人中实现计算机视觉(如果可能的话是立体的)。

谢谢

4

2 回答 2

0

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

我可以找到很多关于 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,我必须自己编译它。

于 2013-03-17T18:15:35.437 回答
0

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

#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
于 2016-03-11T22:35:26.380 回答