PDA

View Full Version : Opencv in Qt



mohanakannan
15th August 2013, 13:56
Hi friends,
I have been to call the opencv function from Qt(Qml),but it doesn’t working well…It always showing error(Undefined reference to cvLoadImage,cvNamedWindow,etc.)….But when i run that opencv code in console application means ,it is running well..But when i using it with Qt,it is displaying this error..Could anyone please sought out the problem..
thanks in advance..

danics
15th August 2013, 20:41
it seems you dont add library of opencv to qt correctly... so google it for your opencv version

mohanakannan
26th August 2013, 17:02
Hi friends,
Sorry for the delay sir. I’ve used pro file as
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \


This is what i’m trying. From Qml, i’m calling a function.

QString mainwindow::get_opencv(QString &get_word)
{
IplImage *img2 = cvLoadImage("images_.png");
CvPoint pt1 = cvPoint(130,90);
int thickness = 2;
char text[20];
char m_framecnt[100]="kannamohan";
CvScalar blue = CV_RGB(0,0,250);
double hscale = 1.0;
double vscale = 1.0;
double shear = 0;
//int thickness2 = 1;
int line_type = 4;
snprintf(text,sizeof(text), "%s",m_framecnt);
cvNamedWindow("Window",CV_WINDOW_AUTOSIZE);
CvFont font1 ;//= fontQt("Times");
cvInitFont(&font1,CV_FONT_HERSHEY_DUPLEX,hscale,vscale,shear,t hickness,line_type);
cvPutText(img2,text,pt1,&font1,blue);
cvShowImage("Window",img2);
cvWaitKey(0);
cvReleaseImage(&img2);
cvDestroyWindow("Window");
}
It is telling undefined reference to cvLoadImage,CvPoint,etc.. please help me sir..