开发者

OpenCV how to put jpeg image buffer to cvShowImage

开发者 https://www.devze.com 2023-01-26 20:17 出处:网络
I have a JPG image in buffer and I would try to show it with cvShowImage. This is not working, however:

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

精彩评论

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