OpenCV无法编译 [英] OpenCV can't compile

查看:125
本文介绍了OpenCV无法编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm a newbie OpenCV user. I'm just trying to learn something about it but I don't know where to start.

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

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

因此,在真正开始之前,我想看看环境是否运行良好,以避免将来浪费时间.这是我发现的一个示例:

So before really starting I'd like to see if the environment is working fine to avoid wasting time in the future. Here is an example I found:

#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中移动,但很难.

I try to compile (Visual studio 2010) But I get something like 150-250 errors. 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.

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

The errors refers to imgproc.hpp miniflann.hpp photo.hpp tracking.hpp and report a lot of undefined identifiers and syntax errors.

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

I have some experience in programming (C with Arduino, Java, Assembly) but I found the openCV documentation very confusing and confused. I'm self taught so any help about how to start would be appreciated, my goal is to implement Coputer vision (stereo if possible) into my 2WD robot.

谢谢

推荐答案

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

Assuming that you have installed OpenCV correctly on you PC and have set up the IDE as you should, you need to include more libraries in your code... Try adding this to the top of your code(I have OpenCV version 3.1 and this code works for me... And I'm a newbie too!)

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

这篇关于OpenCV无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆