PDA

View Full Version : MemoryCurrentGrabberColorformat = ICImagingControlColorformats.ICUYVY cause exception



Virdung
March 20, 2009, 15:49:22
Hi

I have a question about the MemoryCurrentGrabberColorformat and UYVY format.

I want to use the UYVY format in my imagebuffers but when trying MemoryCurrentGrabberColorformat = ICImagingControlColorformats.ICUYVY and ICException is raised.

The same seem to apply for the ICBY8, ICYGB0 and ICYGB1 aswell.

Im using videoformat UYVY 640x480. And want to use either a sink or accessing the imagebuffer using the ImageAvailable event.

Have I misunderstood anything basic about this?
The device Im using is a video to firewire converter.

Regards
Martin

Stefan Geissler
March 20, 2009, 16:26:08
Martin,

does the exception orrcur due to the assignment or due to the livestart call?

If this happened due to the livestart call, then there is no filter available, that does the color transformation from the video format of the camera to the sink format. e.g. there is no transformation fom Y800 to UYVY available.
Also there are no transformations into the other formats you mentioned availalbe.

At least, UYVY 640x480 should be possible to be used with YUVY in sink. But YUY2, used by the USB cameras can not be converted into UYVY.

Virdung
March 20, 2009, 23:38:17
Thanks Stefan
The exception occur due to the assignment.

If the problem can't be solved I guess it would be possible to do the conversion from rgb to uyvy right before processing the imagebuffer (would mean another copy of data). Or in an own framefilter.

Edit: And if I want to have the frame in UYVY format it seems strange that I have to have the API convert it from UYVY into RGB and then myself convert it back to UYVY again.

/Martin

Virdung
March 23, 2009, 09:23:32
If I set the MemoryCurrentGrabberColorFormat in the design view to ICUYVY. Run and load settings. Break before livestart and inspect the ICImagingControl I ge:
MemoryPixelFormat = 'icImagingControl1.MemoryPixelFormat' threw an exception of type 'System.ArgumentException'.
Further inspection gives Message = "UYVY is not defined as a PixelFormat in GDI+."

Is this supposed to work in the first place?
I just want to get UYVY frames what is it that Im doing wrong? I can't be the first one that wants a mediastream in UYVY format?

/Martin

Stefan Geissler
March 23, 2009, 09:51:49
Martin,

You are right. If a video capture device was selected then the assignmet of MemoryCurrentGrabberColorFormat can rise an exception, if there was no color conversion possible.
If you wanted to use the ICUYVY video format, then you must remove the OverlayBitmap object first:

icImagingControl1.OverlayBitmapPosition = TIS.Imaging.PathPositions.None;
The Overlaybitmap works on RGB and Y800 formats only, not on UYVY format.

Secondly, the video capture device must provide the UYVY video format, because there is no transformation from other video formats into UYVY available. Thus your code should look as follows:

icImagingControl1.Device = icImagingControl1.Devices[0].Name; // Simple device selection...
icImagingControl1.VideoFormat = "UYVY (640x480)"; // Should match to your camera.
icImagingControl1.OverlayBitmapPosition = TIS.Imaging.PathPositions.None;
try
{
icImagingControl1.MemoryCurrentGrabberColorformat = TIS.Imaging.ICImagingControlColorformats.ICUYVY;
}
catch (Exception Ex)
{
Console.WriteLine(Ex.Message);
}

If you used an USB camera, then you can not use the UYVY format, because the USB cameras provide a YUY2 format. Same for monochrome cameras, they only have Y800 video format.

Virdung
March 23, 2009, 12:22:13
Hi

It was the missing icImagingControl1.OverlayBitmapPosition = TIS.Imaging.PathPositions.None; That caused the problems.
Thanks alot for the help

Regards
Martin