Acquire Property Information

This example demonstrates how to acquire information about the properties supported by a selected video capture device.

The program can be found in the %TOPLEVEL%\Samples\VC\SimpleProperty directory. In order to run the program, open the solution file SimpleProperty.sln in this directory and select Build -> Build SimpleProperty in the menu. Then the program can be executed by selecting Debug -> Start.

The program uses Grabber::showDevicePage to let the user select a video capture device.

Grabber::getVCDPropertyInterface is used to access the device property interfaces:

tIVCDPropertyItemPtr exposure = grabber.getVCDPropertyItem( VCDID_Exposure );
if( exposure == NULL )
{
    std::cout << "Exposure property not available" << std::endl;
    return;
}
tIVCDSwitchPropertyPtr exposure_auto = grabber.getVCDPropertyInterface<IVCDSwitchProperty>( VCDID_Exposure, VCDElement_Auto );
if( exposure_auto == NULL )
{
    std::cout << "Exposure property has no auto" << std::endl;
}
else
{
    std::cout << "Exposure auto enabled=" << exposure_auto->getSwitch()  << std::endl;
}
tIVCDRangePropertyPtr exposure_range = grabber.getVCDPropertyInterface<IVCDRangeProperty>(VCDID_Exposure, VCDElement_Value );
if( exposure_range == NULL )
{
    std::cout << "Exposure property has no range interface" << std::endl;
}
else
{
    std::cout << "Current Exposure range value: " << exposure_range->getValue() << std::endl;
    std::cout << "Exposure range range: [" << exposure_range->getRangeMin() << ".." << exposure_range->getRangeMax() << "]" << std::endl;
}
tIVCDAbsoluteValuePropertyPtr exposure_absolute = grabber.getVCDPropertyInterface<IVCDAbsoluteValueProperty>( VCDID_Exposure, VCDElement_Value );
if( exposure_absolute == NULL )
{
    std::cout << "Exposure property has no absolute value interface" << std::endl;
}
else
{
    std::cout << "Current Exposure absolute value: " << std::fixed << exposure_absolute->getValue() << " " << exposure_absolute->getDimType() << std::endl;
    std::cout << "Exposure absolute range: [" << exposure_absolute->getRangeMin() << ".." << exposure_absolute->getRangeMax() << "]" << std::endl;
}

By calling Grabber::getVCDPropertyItem with the parameter VCDID_Exposure, the program checks whether the opened video capture device supports the exposure property. If exposure is supported, Grabber::getVCDPropertyInterface is called to get the exposure auto interface. This is then used to check if the device has exposure automation enabled.

Grabber::getVCDPropertyInterface is then used to check whether there is a absolute value interface available for the exposure value. If it is, the current value is printed along with the range of possible values.

After that, Grabber::getVCDPropertyInterface is used again to check for an absolute value interface. If it is found, the current value is printed along with its unit and the range of possible absolute values.

The availability of the interfaces depends on the video capture device. Not all devices support the absolute value interface for exposure.

<< Programmer's Guide