Get RAW stream of webcam

6 views (last 30 days)
Michael Eschey
Michael Eschey on 17 Dec 2015
Commented: mario iobbi on 1 Dec 2017
We are using a camera that is detected correctly by the Image Acquisition Toolbox as Webcam. But the camera Firmware provides a wrong data format information. The Information it gives is YUY2 as format, but what it actually delivers is a 12bit per Pixel image (2 Bytes with 4 bit unused) in a BGGR Bayer pattern. Now when acquiring images with the Toolbox it misinterprets the image and outputs a 3-channel image. I assume it trys to convert my data from YUY2 to RGB which turns out to be wrong. Is there a way to get the raw byte stream from the webcam with the Toolbox?
  6 Comments
Michael Eschey
Michael Eschey on 30 Nov 2017
We did not write an IMAQ adapter after all and instead chose to compile it with MEX. The part to acquire the stream though would be the same. Nevertheless you would need to cope with gamma correction, demosaicing and color correction by yourself then.
mario iobbi
mario iobbi on 1 Dec 2017
Thank you for responding. Glad to know that it is feasible but it is unfortunate that it isn't straightforward. You would not happen to still have the code and be willing to share the the code to aquire the stream someplace?

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 21 Dec 2015
What does this say:
fprintf('ReturnedColorspace = %s', vidobj.ReturnedColorspace);
where vidobj is your video object.
  2 Comments
Michael Eschey
Michael Eschey on 22 Dec 2015
The returned colorspace is 'YCbCr'. Changing it to rgb doesn't change the output. Grayscale just gives me something monochrome which is not my image and only with 1Byte per pixel.
Image Analyst
Image Analyst on 22 Dec 2015
Edited: Image Analyst on 22 Dec 2015
How do you know that the gray scale output is not just raw bytes, which represent your mosaiced values? For example the Mandi "gray scale" demo image that ships with MATLAB?

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!