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
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
ReplyDeleteThank you for your tutorial. It is really helpful for a beginner like me.
ReplyDeletehi..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.
ReplyDeleteThanks for the tutorial. this is the only tutorial out of 20 that got me started with opencv
ReplyDeletekavitha is right on the spot ..but what is going to take using for a path outside the app folder to work ?
ReplyDeleteThank you for your awesome tutorial :)
ReplyDeleteI have same problem.
ReplyDeleteThank you, so much!!! You're a genius! haha
ReplyDeletegetting same problem .....
ReplyDeletecan any one solve this....
This comment has been removed by the author.
ReplyDeleteAdd one backslash in the image name, like the video, for example: C:\\Desktop\\blackcar.jpg
ReplyDeleteHello,
ReplyDeleteI 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?
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?
ReplyDeleteSuperb video. Too bad there isn't one for 2.4.6 and VS 2013 c++.. There are differences between the IDEs. Still, quite helpful.
ReplyDeleteN. Calif, USA
i was able to solve...
ReplyDeleteby ...going to project properties->linker->general->enable incremental linking->No(set this to no) and it works
so good..everything is very clear.. Your are good mentor.
ReplyDeleteCan anyone provide me any good documentation that help me to learn opencv?
Thank you so much its working very nicely and great job.
ReplyDeleteI 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
ReplyDeleteanyone can help ?
When I try to build it says
ReplyDeleteError 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!
got the exact same prob ..followed different tuts really carefully...though its 3.0..and im using x64
Deleteplease help. working for two days:
ReplyDeletehaving 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
I am using opencv2.4.10 , visual studio 2010 , having 64 bit operating system
ReplyDeletethanks in advance