PDA

View Full Version : MemoryCurrentGrabberColorFormat vs Videoformat



acanicio
December 26, 2009, 10:57:58
Dear Stefan,

Is there a relationship between these two properties ? :

ICImagingControl.MemoryCurrentGrabberColorFormat
ICImagingControl.Videoformat

I'm asking the question because of the following :

1 - I set the VideoFormat to "YGB0 (1280x960)" (the camera is a DBK41AG02.AS).

2 - When an "ImageAvailable" event happens, I retrieve the buffer data in order to convert it into an image.
In order to create an image with the correct bit depth, I read the "ICImagingControl.ImageBitsPerPixel" property.
I always obtain the value "24" (i.e RGB image).
I think this is incorrect, since the YGB0 format is 10 bits per color, I thought I should have obtained "30" or "48" in the ImageBitsPerPixel property.

So I changed some lines and tried to set the "MemoryCurrentGrabberColorFormat" property to ICYGB0 at the same time as I change the "VideoFormat" property.


Function GetGrabberColorFormat(VideoFormat : String) : ICImagingControlColorformats;
Begin
If Pos('BY8',VideoFormat) > 0 then
Begin
Result := ICRGB24;
End
else
If Pos('UYVY',VideoFormat) > 0 then
Begin
Result := ICRGB24;
End
else
If Pos('Y800',VideoFormat) > 0 then
Begin
Result := ICRGB24;
End
else
If Pos('YGB0',VideoFormat) > 0 then
Begin
Result := ICYGB0;
End;

End;

procedure TFRM_CamPropertyDlg.CBX_VideoFormatsChange(Sender: TObject);
begin
If ICImagingControl.DeviceValid then
Begin
If ICImagingControl.LiveVideoRunning then
begin
ICImagingControl.LiveStop;
ICImagingControl.VideoFormat := ICImagingControl.VideoFormats[CBX_VideoFormats.ItemIndex+1].Name;
ICImagingControl.MemoryCurrentGrabberColorFormat := GetGrabberColorFormat(ICImagingControl.VideoFormat );
ICImagingControl.LiveStart;
end
else
Begin
ICImagingControl.VideoFormat := ICImagingControl.VideoFormats[CBX_VideoFormats.ItemIndex+1].Name;
ICImagingControl.MemoryCurrentGrabberColorFormat := GetGrabberColorFormat(ICImagingControl.VideoFormat );
End;

End;

end;



The list of videoformats is chosen from a combobox "CBX_Videoformat", which was previously loaded with the device's available formats.
When I choose a format in the list, I do a livestop, change the videoformat and then do a livestart again. This usually works very well.

But when I added the line where I set the MemoryCurrentGrabberColorFormat property I now get the following error :


EOleException : An option is not available, e.g. you called setFlipH and the VideoCaptureDevice does not support flipping

hummmm.... I never called a setFlipH function...

I suppose I am doing something wrong...

Is there any way to know the real current bit depth of the incoming stream ?

Thank you again for your help :-)

P.S.
Looking on the web I found this thread :
http://www.theimagingsourceforums.com/showthread.php?t=321778

But I do not use any overlay bitmap so it does not apply to my case.



Best regards.
Axel Canicio

Stefan Geissler
January 4, 2010, 09:01:22
Hi

There is no direct relation between these properties. But there must be a color space transformation filter available, that transforms the video format into the MemoryCurrentGrabberColorformat. There are transformations available for converting most formats into RGB. But there are no transformations available for converting into YUV.

The "fliphorizontal" error message is a heritage from earlier times. It was only a sample property.

To your error message: I am not as familiar with Delphi, thus I do not know, how the return value of GetGrabberColorFormat() is handled. What happens, if you assign "ICRGB24" directly to "MemoryCurrentGrabberColorFormat" instead of calling the function? If this works, then there is something wrong with the GetGrabberColorFormat() function.

If you can not figure out this problem, then I have to check this on my own.