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).
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).