错误OpenCV - Qt项目

时间:2013-03-04 12:45:54

标签: opencv

我创建了一个使用OpenCV库(Camera)的简单项目。 但是在编译我的程序时,我看到了这个错误

  

g ++ -m64 -Wl,-rpath,/ usr / local / Trolltech / Qt-4.8.4 / lib -o TestCamera   main.o -lopencv_core -lopencv_highgui   /usr/local/lib/libopencv_highgui.a(cap.cpp.o):在功能上   cv::VideoWriter::write(cv::Mat const&)': cap.cpp:(.text._ZN2cv11VideoWriter5writeERKNS_3MatE+0x18): undefined reference to cv :: Mat :: operator _IplImage()const'

... BLA-BLA

  

window.cpp :( text._ZN2cv14pointCloudShowERKSsRKNS_8GlCameraERKNS_8GlArraysE + 0x8b):   未定义引用cv::error(cv::Exception const&)' window.cpp:(.text._ZN2cv14pointCloudShowERKSsRKNS_8GlCameraERKNS_8GlArraysE+0x93): undefined reference to cv :: Exception :: ~Exception()'   window.cpp :( text._ZN2cv14pointCloudShowERKSsRKNS_8GlCameraERKNS_8GlArraysE + 0x172):   未定义引用`cv :: Exception :: ~Exception()'collect2:ld   返回1退出状态

.pro - 包含libs libopencv_core.a和libopencv_highgui.a,但这不起作用。

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp

LIBS += -lopencv_core -lopencv_highgui

的main.cpp

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <stdlib.h>
#include <stdio.h>

using namespace cv;

int main(int argc, char* argv[])
{
        CvCapture* capture = cvCreateCameraCapture(CV_CAP_ANY); //cvCaptureFromCAM( 0 );
        assert( capture );

        double width = cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH);
        double height = cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT);
        printf("[i] %.0f x %.0f\n", width, height );

        IplImage* frame=0;

        cvNamedWindow("capture", CV_WINDOW_AUTOSIZE);

        printf("[i] press Enter for capture image and Esc for quit!\n\n");

        int counter=0;
        char filename[512];

        while(true){
                frame = cvQueryFrame( capture );

                cvShowImage("capture", frame);

                char c = cvWaitKey(33);
                if (c == 27) {
                        break;
                }
                else if(c == 13) { // Enter
                          sprintf(filename, "Image%d.jpg", counter);
                        printf("[i] capture... %s\n", filename);
                        cvSaveImage(filename, frame);
                        counter++;
                }
        }
        cvReleaseCapture( &capture );
        cvDestroyWindow("capture");
        return 0;
}

我如何解决此问题?

0 个答案:

没有答案