PDA

View Full Version : New in opencv2.3.1 and Qt



danilodsp
28th October 2011, 00:29
Hello friends,

I decided to work with Qt more opencv,
I using the book "OpenCV 2 Computer Vision Application Programming Cookbook", and followed this tutorial:
http://knowtheabc.wordpress.com/2011/02/25/windows-opencv-and-qt-creator/

My code is:
(.pro)

INCLUDEPATH += C:/opencv/build/include/

LIBS += "C:/opencv/build/lib/libopencv_core231.dll.a" \
"C:/opencv/build/lib/libopencv_highgui231.dll.a" \
"C:/opencv/build/lib/libopencv_imgproc231.dll.a" \
"C:/opencv/build/lib/libopencv_features2d231.dll.a" \
"C:/opencv/build/lib/libopencv_calib3d231.dll.a"

(.cpp)

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

int main()
{
cv::Mat imagem = cv::imread("C:/lena.jpg");
cv::namedWindow("Teste");
cv::imshow("Teste", imagem);
cv::waitKey(5000);

return 1;
}



the output is:
"Press <RETURN> to close this window..."
and nothing more.

Making test with stdio and printf I can only print on the screen before of the
my code (just the beginning of the main). If after the code, nothing appears.
(just "Press <RETURN> (...)").

I had enough sense to put the .dll along with the .exe, and also to put the
image in the correct directory.

I tried in my (.pro):

INCLUDEPATH += C:/opencv/build/include/

LIBS += C:/opencv/build/bin/*.dll
but nothing.

In Qt GUI, the window does not open when I use any function opencv.

I hope some help.
Sorry my english.

.,

Added after 25 minutes:

I discovered the error.
I was making two errors.

I did not copy all the dlls required:
QtOpenGL4.dll, QtTest4.dll, ...

And I was copying the dll of the opencv the wrong path. Path correct is (<buld path>/bin/*.dll).

abhigarg
12th November 2012, 16:14
try this path for the image:
"C://lena.jpg"

if this doesnt help then try using some image on the desktop because sometimes the OS (mostly windows) does not allow permissions to access data in c drive.

niki_1989
18th November 2012, 19:29
Hi ... I have this problem too .. and i don't know how can i solve it !!! I can't understand how to fixed .. :(
F1 (help) me please !!

ChrisW67
18th November 2012, 22:55
Which problem?