简体   繁体   English

使用Qt + Opencv时未定义的Opencv引用

[英]Undefined Opencv References when using Qt + Opencv

Hello im basically trying to make an application that shows and Opencv Iplimage converted to QImage in a label, i did a simple example and it worked just fine, but now when i try to integrate that image convertion to another project,i get undefined Opencv functions references like this: undefined reference to `cvQueryFrame'all from the Highgui 您好,我基本上是想制作一个可以在标签中显示并将Opencv Iplimage转换为QImage的应用程序,我做了一个简单的示例,它的工作正常,但是现在当我尝试将该图像转换集成到另一个项目时,我得到了未定义的Opencv函数像这样的引用:Highgui对`cvQueryFrame'的未定义引用

Im actually using the same library paths i used when i first tried that image convertion, just that this time its not working. 我实际上使用的是我第一次尝试该图像转换时使用的库路径,只是这次它不起作用。 Im quite new with Qt, and i dont know where the problem might be: 我对Qt很陌生,我不知道问题可能在哪里:

 #include <qt4/QtGui/QApplication>
 #include "myqtapp.h"
 #include <iostream>
 #include <stdlib.h>
 #include <stdio.h>
 #include <opencv/highgui.h>
 #include <opencv/cv.h>

 using namespace std;
 int main(int argc, char *argv[])
 {

QApplication app(argc, argv);
myQtApp *dialog = new myQtApp;
//********************************************************************************************************
QImage myImage; 
QLabel label_5;
IplImage* frame;   
//label_5 = new QLabel(myQtAppDLG); //Not using this Yet
CvCapture* capture = cvCreateFileCapture( "garden.bmp" );  
frame = cvQueryFrame( capture );
cvCvtColor(frame,frame,CV_BGR2RGB); 
myImage = QImage((unsigned char *)frame->imageDataOrigin,frame->width,frame->height,QImage::Format_RGB888);  
//label_5.setPixmap(QPixmap::fromImage(myImage)); //Not using this Yet
//********************************************************************************************************
dialog->show();  
return app.exec();

} }

 main.cpp:(.text+0x44): undefined reference to `cvCreateFileCapture'
 main.cpp:(.text+0x4c): undefined reference to `cvQueryFrame'
 main.cpp:(.text+0x62): undefined reference to `cvCvtColor'

As you see the first thing i try to do is just to use some Opencv Functions like CvQueryFrame, the funny thing is that im using the exact same include paths i used the first time, also linked the exact same dynamic libraries. 如您所见,我尝试做的第一件事就是仅使用某些Opencv函数(例如CvQueryFrame),有趣的是,即时消息使用的是我第一次使用的完全相同的包含路径,还链接了完全相同的动态库。 I've tried different paths and compiler but nothing seems to work, i dont know where the error might be. 我尝试了不同的路径和编译器,但似乎无济于事,我不知道错误可能在哪里。 Im using Linux Ubuntu and Netbeans C++, Any hint? 我正在使用Linux Ubuntu和Netbeans C ++,有什么提示吗?

You have missed to include the highgui library in your library path. 您错过了将highgui库包含在库路径中。 cvCreateFileCapture and cvCvtColor are part of that library. cvCreateFileCapture和cvCvtColor是该库的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM