我是新手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/