Buffer to Mat [closed]
Hello guys,
I need your help.
I work with two cameras with a resolution of 4000x3000. Because of USB3 Vision I can only access with the manufacturer api on pictures.
As return value I get a pointer
void* BufferCam = NULL;
Strm_ReadCurrentImage(mStrmCam, BufferCam, &uiPyldSize, &sImageInfo);
Now I want to write the data into a cv Mat like this
Mat mCam= Mat(3000, 4000, CV_8UC3, BufferCam, Mat::AUTO_STEP);
Unfortunately my matrix keep empty. If I change size of the rows and cols like this
Mat mCam= Mat(1080, 1920, CV_8UC3, BufferCam, Mat::AUTO_STEP);
it work, but the image is understandably garbage.
can you try to find out the pixel format of your original buffer ? maybe CV_8UC3 is not adequate here.
also, be very cautious with constructors like above (shallow pointer copy), you eithere have to keep your original buffer in scope, or make a clone() of your Mat.
These are the image information I get from the function.
Or do you mean something different?
3000 x 4000 = 12000000 - so i'd rather guess it's either grayscale (CV_8U) or something like yuv4:2:2 (which also would fit into a single byte)
also, please look up your vendor's documentation, what do they say about it ?
About the PixelFormat I found the following
https://secure.toshiba-teli.co.jp/ttf...
According to api the Pixel Format is BayerGR8
^^ yea, that was actually very helpful !
looking at your screenshot again, and the uiPixelFormat :
17301512 == 0x1080008, so it's BayerGR8 (oh, dear, that'll be fun unrolling)
Is working. Thank you very much :)