網頁

2017年4月9日 星期日

[OpenCV] Using static library in Visual Studio 2015 Console mode


Create Visual Studio 2015 console program

image

Add VideoCapture calls

#include "stdafx.h"
#include <opencv2/opencv.hpp>
int main()
{
    cv::Mat frame;
    cv::VideoCapture cap(0);
    if (!cap.isOpened()) {
        return -1;
    }
    while (true) {
        if (!cap.read(frame))
            break;
        cv::Mat src = cv::Mat(frame);
        cv::imshow("window", src);
        cv::waitKey(30);
    }
}

Add OpenCV include path

D:\OpenCV-3.2.0\opencv\build\include

Add OpenCV library path

D:\OpenCV-3.2.0\opencv\build\x86-static\lib\Release
D:\OpenCV-3.2.0\opencv\build\x86-static\3rdparty\ippicv\ippicv_win\lib\ia32
D:\OpenCV-3.2.0\opencv\build\x86-static\3rdparty\lib\Release

Add OpenCV library

kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
opencv_highgui320.lib
opencv_core320.lib
ippicvmt.lib
zlib.lib
opencv_imgproc320.lib
opencv_imgcodecs320.lib
IlmImf.lib
libjpeg.lib
libjasper.lib
libpng.lib
libtiff.lib
libwebp.lib
opencv_video320.lib
opencv_videoio320.lib
vfw32.lib

Modify project configuration

image
image
image

Compile and Run

沒有留言:

張貼留言

請提供您寶貴的意見