Visual studio 2012 + OpenCV 2.46 Setting method

First of all, download opencv 2.46 on this page -> http://opencv.org/downloads.html
The version 2.4.6 is latest version.


Extract in appropriate folder. " C:\OpenCV264\ " this path is suitable.

In VS2012 setting..
In the project properties, add lib and include path information.


Copy all dll files in the 'C:\opencv246\build\x86\vc11\bin' paste them to 'C:\Windows\system' . 

and sample source code

------------------------------------------------

#include < stdio.h >
#include < opencv2\opencv.hpp >


#ifdef _DEBUG
#pragma comment(lib, "opencv_core246d.lib") 
#pragma comment(lib, "opencv_imgproc246d.lib")   //MAT processing
//#pragma comment(lib, "opencv_objdetect246d.lib") 
//#pragma comment(lib, "opencv_gpu246d.lib")
//#pragma comment(lib, "opencv_features2d246d.lib")
#pragma comment(lib, "opencv_highgui246d.lib")
//#pragma comment(lib, "opencv_ml246d.lib")
#else
#pragma comment(lib, "opencv_core246.lib")
#pragma comment(lib, "opencv_imgproc246.lib")
//#pragma comment(lib, "opencv_objdetect246.lib")
//#pragma comment(lib, "opencv_gpu246.lib")
//#pragma comment(lib, "opencv_features2d246.lib")
#pragma comment(lib, "opencv_highgui246.lib")
//#pragma comment(lib, "opencv_ml246.lib")
#endif

using namespace cv;


void main()
{
 Mat img;
 img = imread("test.jpg");
 namedWindow("t");
 imshow("t",img);
 cvWaitKey(0);
}



------------------------------------------------------------

Thank you.

Comments

  1. please help me with a very minor doubt

    WHere do I include C/C++ header files stdio.h, iostream.h etc.

    If I am adding these files in opencvs header files it's still unable to read them.


    Please Help ! Thanks alot !

    ReplyDelete
  2. d:\opencv246\build\include\opencv2\core\types_c.h(55): fatal error C1083: Cannot open include file: 'assert.h': No such file or directory

    ReplyDelete
  3. I have moved forward but stuck at this point Please Help !

    cannot open file kernel32.lib visual studio 2010

    Added $(WindowsSDK)lib BUT STILL NO FIX !

    ReplyDelete
  4. I don't know exactly what your error.
    But one doubt is.. if you set to vs2010, you have to use vs10 lib and dll.
    Check again.

    and
    Including header files 'iostream.h, stdio.h...' to the main.cpp.
    Thank you.

    ReplyDelete

Post a Comment

Popular posts from this blog

OpenCV Stitching example (Stitcher class, Panorama)

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Optical Flow sample source code using OpenCV

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

(OpenCV Study) calcOpticalFlowFarneback example source code ( dense optical flow )

yuv422(YUYV) to RGB and RGB to yuv422(YUYV), (Using OpenCV and TBB)

(C, C++) TinyXML , xml read & write