编译器: mingw32 gcc 4.8.1
mingw32 g++ 4.8.1
QT 版本: 4.8.6
OpenCV版本: 3.0.0
测试平台: win7 x64
-----------------------
重点: OpenCv 3.0.0 需要重新编译
并对相关文件进行修改,否则无法使用qt 4.8.6 进行编译。
OpenCV测试代码:
OpenCv_test.cpp
/* * filename: OpenCv_test.cpp */ #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <cv.hpp> #include <cxcore.hpp> #include <video/video.hpp> using namespace cv; int main() { VideoCapture cap(0); if(!cap.isOpened()) { return -1; } Mat frame; Mat edges; bool stop = false; while(!stop) { cap>>frame; cvtColor(frame, edges, /*CV_BGR2RGB*/CV_BGR2BGRA ); // 0 // GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5); //Canny(edges, edges, 0, 30, 3); imshow("Camera",edges); if(waitKey(30) >=0) stop = true; } return 0; }
OpenCv_test.pro
SOURCES += OpenCv_test.cpp HEADERS += INCLUDEPATH += E:\OpenCv_3.0.0_build\include E:\OpenCv_3.0.0_build\include\opencv E:\OpenCv_3.0.0_build\include\opencv2 LIBS += E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_calib3d300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_core300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_features2d300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_flann300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_hal300.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_highgui300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_imgproc300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_imgcodecs300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_ml300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_objdetect300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_photo300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_video300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_videoio300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_videostab300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_shape300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_stitching300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_superres300.dll.a E:\OpenCv_3.0.0_build\x86\mingw\lib\libopencv_ts300.a
编译运行效果:
时间: 2024-11-05 07:24:58