开发者

cvShowImage doesn't show the image

Sometimes cvshowimage of openCV doesn't show the image, but shows a black empty one.

Does 开发者_开发知识库anyone know why and when this happens?


cvShowImage(img);
cvWaitKey(0);

Make sure the second statement is there, otherwise the image will not be redrawn.

Also note that if your image is black and empty, then cvShowImage will show you a black and empty image. That doesn't mean it is broken -- what's more likely is that there is a problem with the way you are loading/manipulating the image. It's hard to say more without looking at your source code.


to show image using opencv in vc++ below code is very simple an easy

#include <cv.h>
#include <highgui.h>
using namespace std;

int main(void)
{
   IplImage* img =  cvLoadImage("d:\\gray.bmp"); 
         //show the  image
        cvNamedWindow("gray");
        cvShowImage("gray",img);
         cvWaitKey(0); //wait for a key press

        //cleaning up
        cvDestroyAllWindows(); 
        cvReleaseImage(&img);

        return 0;

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜