How can I get full data out of videoinput?

2 次查看(过去 30 天)
I'm using videoinput which comes with the Image Acquisition Toolbox. I'm also using an Imperx Express framegrabber.
Regardless of my settings, I can not get the full data out of the image acquisition. My bayer sensor sends 24bpp data packed into RGB planes; each input pixel maps 12 bits to one pixel and 12 bits to the adjacent pixel (i.e. each input pixel maps to two output pixels, input = nxm pixels, output = nx2*m pixels.) So I should just be able to set video format to 'RGB24' when setting up the videoinput object. The "returned color space" is set to 'rgb'. So I would hope that the full 24 bits coming in would map to the RGB planes without issue.
This is totally not the case and quite the aggravation. It returns RGB data, but the R plane is identical to the G plane, and so forth (therefore providing 8bpp, not 24bpp.) Is there any possible way to set up the videoinput object such that I can get my full bitdepth out?
Here is the code I'm using:
vidobj = videoinput('fleximaq',1,'RGB24'); %RGB24 is a valid format for this framegrabber
vidobj.ReturnedColorSpace = 'rgb';
vidobj.FramesPerTrigger = 1;
start(vidobj);
x = double(getdata(vidobj));
isequal(x(:,:,1),x(:,:,2))
max(x(:))
and the corresponding return:
ans =
1
ans =
255
Therefore showing that I am in fact only getting 8 bpp even though my sensor is sending 24. Is it just throwing away the rest of the data?
  1 个评论
Nate Smith
Nate Smith 2017-3-23
Oh, and the maximum single-channel video format for this framegrabber is 'Mono16', still cutting out 8 bits.

请先登录,再进行评论。

回答(1 个)

Nanda Gupta
Nanda Gupta 2017-3-28
I understand that you are trying to get the full 24 bits coming in and you want to set up the video input object such that you can get the full bitdepth out.
You can set this accordingly and get the data using the "getdata" function by specifying the type in it explicitly.
For more information regarding "getdata" function, you can refer, http://www.mathworks.com/help/imaq/getdata.html
Also, you can check the parameters for your sensor using the "imaqhwinfo" function. By default, the "NativeDataType" property is set to "uint8". For, more information regarding this, you can refer, https://www.mathworks.com/help/imaq/imaqhwinfo.html

Community Treasure Hunt

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

Start Hunting!

Translated by