messi
messi

Reputation:

How to use cvLoadImage to load to OpenCV Window?

I have the image file on hard disk.

I use "cvLoadImage" to load it and display it on OpenCV's Window. Although this file exists, but, I get a blank window. I can't resolve this problem.

Upvotes: 0

Views: 1775

Answers (2)

user1695106
user1695106

Reputation: 1

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

That will let computer have a breathing time to display which image you want to show.

Upvotes: 0

Gab Royer
Gab Royer

Reputation: 9806

Here is the code that does 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 do you get (if any).

Upvotes: 2

Related Questions