Top Banner
OpenCV 2.4.9 In Windows
32
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: OpenCV installation in windows visual studio

OpenCV 2.4.9

In Windows

Page 2: OpenCV installation in windows visual studio

IMPORTANT NOTES:

# In My System the location of OpenCv2.4.9 is C:\

and so have used C:\opencv\build\

# Prefer to extract The OpenCv file into drive C:\

# This settings is for WINDOWS With 64 Bit Operating system and you have to follow the

NOTES for 32Bit System

# Have Installed Visual Studio 2013

>>and so in the code ";%OPENCV_DIR%\x64\vc12\bin" and "$(OPENCV_DIR)\x64\vc12\lib"

I have used the vc12

# If you have installed Visual Studio 2012 then use vc11.

Page 3: OpenCV installation in windows visual studio
Page 4: OpenCV installation in windows visual studio
Page 5: OpenCV installation in windows visual studio

Step 5

OPENCV_DIR

C:\opencv\build\

Step 8

;%OPENCV_DIR%\x64\vc12\bin

NOTE:

For 32Bit (x86) System Replace x64 with x86

Page 6: OpenCV installation in windows visual studio
Page 7: OpenCV installation in windows visual studio
Page 8: OpenCV installation in windows visual studio
Page 9: OpenCV installation in windows visual studio
Page 10: OpenCV installation in windows visual studio
Page 11: OpenCV installation in windows visual studio

For 32Bit System SKIP The STEPS From 11 to

14.

NEED NOT CHANGE THE PLATFORM TO

x64 LEAVE IT AS WIN32.

Page 12: OpenCV installation in windows visual studio
Page 13: OpenCV installation in windows visual studio
Page 14: OpenCV installation in windows visual studio
Page 15: OpenCV installation in windows visual studio
Page 16: OpenCV installation in windows visual studio
Page 17: OpenCV installation in windows visual studio
Page 18: OpenCV installation in windows visual studio

Additional Include Directories

$(OPENCV_DIR)\include

Additional Library Directories

$(OPENCV_DIR)\x64\vc12\lib

NOTE:

For 32Bit (x86) System Replace x64 with x86

Page 19: OpenCV installation in windows visual studio
Page 20: OpenCV installation in windows visual studio
Page 21: OpenCV installation in windows visual studio
Page 22: OpenCV installation in windows visual studio

Depending on the Opencv Version the library names have to be

modified in the text given .

In the next slide you will see a set of library names like

“opencv_gpu249.lib”

Here 249 corresponds to the Opencv Version (2.4.9)

If you are using Opencv 2.4.5 Then replace 249 with 245

Page 23: OpenCV installation in windows visual studio

opencv_gpu249.lib

opencv_ocl249.lib

opencv_gpu249d.lib

opencv_ocl249d.lib

opencv_highgui249.lib

opencv_photo249.lib

opencv_highgui249d.lib

opencv_photo249d.lib

opencv_calib3d249.lib

opencv_imgproc249.lib

opencv_stitching249.lib

opencv_calib3d249d.lib

opencv_imgproc249d.lib

opencv_stitching249d.lib

opencv_contrib249.lib

opencv_legacy249.lib

opencv_superres249.lib

opencv_contrib249d.lib

opencv_legacy249d.lib

opencv_superres249d.lib

opencv_core249.lib

opencv_ml249.lib

opencv_ts249.lib

opencv_core249d.lib

opencv_ml249d.lib

opencv_ts249d.lib

opencv_features2d249.lib

opencv_nonfree249.lib

opencv_video249.lib

opencv_features2d249d.lib

opencv_nonfree249d.lib

opencv_video249d.lib

opencv_flann249.lib

opencv_objdetect249.lib

opencv_videostab249.lib

opencv_flann249d.lib

opencv_objdetect249d.lib

opencv_videostab249d.lib

Copy Paste the Entire set into Additional Dependencies

Page 24: OpenCV installation in windows visual studio

NEED NOT DO THE STEPS FOR DEBUG only

Release is necessary.

If you need to build in

DEBUG mode then do the steps from 23 to 25

Page 25: OpenCV installation in windows visual studio

Additional Include Directories

$(OPENCV_DIR)\include

Additional Library Directories

$(OPENCV_DIR)\x64\vc12\lib

NOTE:

For 32Bit (x86) System Replace x64 with x86

Page 26: OpenCV installation in windows visual studio
Page 27: OpenCV installation in windows visual studio
Page 28: OpenCV installation in windows visual studio

opencv_gpu249.lib

opencv_ocl249.lib

opencv_gpu249d.lib

opencv_ocl249d.lib

opencv_highgui249.lib

opencv_photo249.lib

opencv_highgui249d.lib

opencv_photo249d.lib

opencv_calib3d249.lib

opencv_imgproc249.lib

opencv_stitching249.lib

opencv_calib3d249d.lib

opencv_imgproc249d.lib

opencv_stitching249d.lib

opencv_contrib249.lib

opencv_legacy249.lib

opencv_superres249.lib

opencv_contrib249d.lib

opencv_legacy249d.lib

opencv_superres249d.lib

opencv_core249.lib

opencv_ml249.lib

opencv_ts249.lib

opencv_core249d.lib

opencv_ml249d.lib

opencv_ts249d.lib

opencv_features2d249.lib

opencv_nonfree249.lib

opencv_video249.lib

opencv_features2d249d.lib

opencv_nonfree249d.lib

opencv_video249d.lib

opencv_flann249.lib

opencv_objdetect249.lib

opencv_videostab249.lib

opencv_flann249d.lib

opencv_objdetect249d.lib

opencv_videostab249d.lib

Copy Paste the Entire set into Additional Dependencies

Page 29: OpenCV installation in windows visual studio
Page 30: OpenCV installation in windows visual studio

#include "stdafx.h"

#include "opencv2/highgui/highgui.hpp"

#include <iostream>

using namespace cv;

using namespace std;

int main(int argc, char* argv[])

{

VideoCapture cap(0); // open the video camera no. 0

if (!cap.isOpened()) // if not success, exit program

{

cout << "Cannot open the video file" << endl;

return -1;

}

double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video

double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video

cout << "Frame size : " << dWidth << " x " << dHeight << endl;

namedWindow("MyVideo", CV_WINDOW_AUTOSIZE); //create a window called “MyVideo”

Mat frame;

while (1)

{

bool bSuccess = cap.read(frame); // read a new frame from video

if (!bSuccess) //if not success, break loop

{

cout << "Cannot read a frame from video file" << endl;

break;

}

imshow("MyVideo", frame); //show the frame in “MyVideo” window

if (waitKey(30) == 27) //wait for ‘esc’ key press for 30ms. If ‘esc’ key is pressed, break loop

{

cout << "esc key is pressed by user" << endl;

break;

}

}

return 0;

}

Sample Code

For Codes:

http://pastebin.com/fVzH4QcL

Page 31: OpenCV installation in windows visual studio

NOTE:

After Building the code ,the location where the .exe is located should contain a picture named

“ fish.jpg “. otherwise while running it shows error.

#include "stdafx.h"

#include "opencv2/opencv.hpp"

#include<iostream>

using namespace cv;

using namespace std;

int main(int argc, char* argv[])

{

Mat input_asb;

input_asb = imread("fish1.jpg",CV_LOAD_IMAGE_UNCHANGED);

namedWindow("mypic",CV_WINDOW_AUTOSIZE);

imshow ("mypic",input_asb);

waitKey(0);

return 0;

}

Sample Code

For codes:

http://pastebin.com/XZzDe6k0

Page 32: OpenCV installation in windows visual studio

THANKYOUBy

P E T E R J O S E

[email protected]

www.robocet.com