开发者

OpenCV how to put jpeg image buffer to cvShowImage

I have a JPG image in buffer and I would try to show it with cvShowImage. This is not working, however:

// buff is a JPEG image with 640*480 dimensions

IplImage* fIplImageHeader;
fIplImageHeader = cvCreateImageHeader(cvSize(640, 480), 8, 1);
fIplImageHeader->imageData = (char *)buff;

cvShowImage("Window 1", fIplImageHeader);
cvWaitKey();

cvReleaseImageHeader(&fIplImageHeader);
开发者_如何学Go

I get a black window with that.


Looks like you forgot to set widthStep

  |-- int  widthStep;     // size of aligned image row in bytes
  |-- int  imageSize;     // image data size in bytes = height*widthStep
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜