簡體   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