OpenCV 2.4.7 - How to install and Create Sample Project in Visual Studio

Below are the sample programs


The program below is for opening webcam 

#include <opencv\cv.h>
#include <opencv\highgui.h>

using namespace cv;
int main(){


Mat image;

VideoCapture cap;
cap.set(CV_CAP_PROP_FRAME_WIDTH, 640);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
cap.open(0);

namedWindow("window",1);
while(1)
{

try
{
cap>>image;

imshow("window",image);
}
catch (Exception& e)
{
const char* err_msg = e.what();
std::cout << "exception caught: imshow:\n" << err_msg << std::endl;
}
waitKey(33);
}

}




The program below is for opening an image



#include <opencv\cv.h>
#include <opencv\highgui.h>

using namespace cv;

int main(int argc, char** argv)
{
IplImage* img = cvLoadImage( "image.png" ); //change the name (image.jpg) according to your Image filename.
cvNamedWindow( "Example1", CV_WINDOW_NORMAL );
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( "Example1" );
return 0;
}

Version 2.4.7 Additional Dependencies

opencv_core247d.lib
opencv_imgproc247d.lib
opencv_highgui247d.lib
opencv_ml247d.lib
opencv_video247d.lib
opencv_features2d247d.lib
opencv_calib3d247d.lib


Comments

  1. Very nice tutorial both program are running fine brother by following ur simple steps...waiting for more such tutorials on opencv how to opencv libraries....thank you very much

    ReplyDelete
  2. Thank you for your tutorial. It is really helpful for a beginner like me.

    ReplyDelete
  3. hi..suppose if the image location is C:\opencv247 then in code write- IplImage* img = cvLoadImage( "C:\\opencv247\\image1.jpg" ); extra \ is given as escape sequence.

    ReplyDelete
  4. Thanks for the tutorial. this is the only tutorial out of 20 that got me started with opencv

    ReplyDelete
  5. kavitha is right on the spot ..but what is going to take using for a path outside the app folder to work ?

    ReplyDelete
  6. Thank you for your awesome tutorial :)

    ReplyDelete
  7. Thank you, so much!!! You're a genius! haha

    ReplyDelete
  8. getting same problem .....
    can any one solve this....

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Add one backslash in the image name, like the video, for example: C:\\Desktop\\blackcar.jpg

    ReplyDelete
  11. Hello,
    I followed the steps through the video and trying to open an image file but when I start debugging I got unresolved external symbol errors. I also tried to copy the correspondent dll-s into the project folder but no use. How can I resolve this issue?

    ReplyDelete
  12. Sir, There's a system error appeared when the time I run it. "The Program can't start because MSVCP120D.dll is missing from you computer. Try reinstalling the program to fix this problem." What should I do to make it work sir?

    ReplyDelete
  13. Superb video. Too bad there isn't one for 2.4.6 and VS 2013 c++.. There are differences between the IDEs. Still, quite helpful.

    N. Calif, USA

    ReplyDelete
  14. i was able to solve...
    by ...going to project properties->linker->general->enable incremental linking->No(set this to no) and it works

    ReplyDelete
  15. so good..everything is very clear.. Your are good mentor.
    Can anyone provide me any good documentation that help me to learn opencv?

    ReplyDelete
  16. Thank you so much its working very nicely and great job.

    ReplyDelete
  17. I got the same problem then I pasted dll from opencv\build\x86\vc12\bin folder , but then another error it started showing cant find MSVCP120D.dll

    anyone can help ?

    ReplyDelete
  18. When I try to build it says
    Error 1 error LNK1181: cannot open input file 'opencv_calib3d300d.lib' c:\Users\--\documents\visual studio 2013\Projects\OPEN_CV_TEST\OPEN_CV_TEST\LINK OPEN_CV_TEST

    I followed the instructions carefully.. Using visual studio 2013 please help!

    ReplyDelete
    Replies
    1. got the exact same prob ..followed different tuts really carefully...though its 3.0..and im using x64

      Delete
  19. please help. working for two days:

    having the following error can't fix.

    1>LINK : fatal error LNK1104: cannot open file 'opencv_core2410d.lib'

    also my lib folder does not have .lib extension files

    ReplyDelete
  20. I am using opencv2.4.10 , visual studio 2010 , having 64 bit operating system
    thanks in advance

    ReplyDelete

Post a Comment