PDA

View Full Version : How to call IC_GetVideoFormat?



dejav
July 28, 2015, 08:33:36
I wish to read the current video format as a string. The docs/header files state:



char* AC IC_GetVideoFormat ( HGRABBER hGrabber, int iIndex )

Get a string representation of the video format specified by iIndex. iIndex must be between 0 and IC_GetVideoFormatCount()...


I don't understand what the iIndex parameter is or where to find its value. Shouldn't the function be telling me either the index or the string value rather than me specifying the value? This seems backwards. How can I find the current video format setting?

Stefan Geissler
July 28, 2015, 11:21:06
As shown in the ansi.c sample:



void ShowProperties()
{
HGRABBER hGrabber; // The handle of the grabber object.
int iInputChannels;
int iVideoFormats;
int i;

printf("ANSI C Grabber Sample\n");

hGrabber = IC_ShowDeviceSelectionDialog(NULL); // Show the built in device select dialog
if( hGrabber )
{

iVideoFormats = IC_GetVideoFormatCount(hGrabber);
for( i = 0; i < iVideoFormats; i++ )
{
printf("%2d. %s\n",i+1,IC_GetVideoFormat(hGrabber,i));
}

iInputChannels = IC_GetInputChannelCount(hGrabber);

printf("%d Input channels\n",iInputChannels);

for( i = 0; i < iInputChannels; i++ )
{
printf("%2d. %s\n",i, IC_GetInputChannel(hGrabber, i));
}

for( i = 0; i < IC_GetVideoNormCount(hGrabber); i++ )
{
printf("%2d. %s\n",i, IC_GetVideoNorm(hGrabber,i));
}

IC_ReleaseGrabber( &hGrabber );
}
}

dejav
July 29, 2015, 00:24:28
In that example index appears to be swept to list all video formats. But how can I find the index of the current video format? Or is this property write only?

Stefan Geissler
July 29, 2015, 13:33:54
Hi


In that example index appears to be swept to list all video formats. But how can I find the index of the current video format? Or is this property write only?

You can not find the index, but the properties of the video format:
int AC IC_GetVideoFormatWidth( HGRABBER hGrabber); ///<Returns the width of the video format.
int AC IC_GetVideoFormatHeight( HGRABBER hGrabber);///<returns the height of the video format.

and for query the pixel format of the images in memory:
COLORFORMAT AC IC_GetFormat( HGRABBER hGrabber ); ///<Returns the current color format of the sink.


This is not exactly the answer to your question, but it allows to query the pixel format, width and height of the images provided by the camera in memory, where you can access them.

Stefan Geissler
July 29, 2015, 13:33:55
Hi


In that example index appears to be swept to list all video formats. But how can I find the index of the current video format? Or is this property write only?

You can not find the index, but the properties of the video format:
int AC IC_GetVideoFormatWidth( HGRABBER hGrabber); ///<Returns the width of the video format.
int AC IC_GetVideoFormatHeight( HGRABBER hGrabber);///<returns the height of the video format.

and for query the pixel format of the images in memory:
COLORFORMAT AC IC_GetFormat( HGRABBER hGrabber ); ///<Returns the current color format of the sink.


This is not exactly the answer to your question, but it allows to query the pixel format, width and height of the images provided by the camera in memory, where you can access them.

dejav
July 30, 2015, 00:53:02
Great, thanks very much Stefan.

I have a similar problem with hardware trigger. It can be set with IC_EnableTrigger, but there doesn't seem to be a way to read it. IC_IsTriggerAvailable only seems to tell whether or not the camera supports a trigger, not whether or not it is enabled. Is this the case?

IC Capture seems to be able to tell if the camera was left with trigger enabled or not, so this functionality must exist.

Stefan Geissler
July 30, 2015, 09:50:19
Hi

There is no function, that queries the current trigger setting.

The simply way to go around this, setting the trigger to the desired value.

Another way is



int Value = 0;
IC_GetPropertySwitch(hGrabber,"Trigger","Enable",&Value);


If value == 1, then the trigger is currently enabled.

dejav
July 30, 2015, 23:26:21
Excellent, thanks so much Stefan.