How can I use cvLoadImage to load into an OpenCV window?

I have an image file on my hard drive.

I am using "cvLoadImage" to load it and display it in an OpenCV window. Although this file exists but I get a blank window. I am unable to resolve this issue.

0


a source to share


2 answers


Here is the code you want to do:

IplImage * image = cvLoadImage("yourpath", CV_LOAD_IMAGE_COLOR);

cvNamedWindow("Window name");
cvShowImage("Window name", image);
cvWaitKey(); //To wait until you pressed a key

cvReleaseImage(&image);

      



Tell me what error message you get (if any).

+2


a source


You just need to put "waitKey (1)"; after showImage (XXX) ;.



This will give the computer time to breathe to display the image you want to display.

0


a source







All Articles