PDA

View Full Version : Access to White Balance and Exposure Settings in XML file or programmatic control



marquezgab
October 30, 2009, 12:31:11
For my application, I am trying to turn all auto settings off to get as stable (in time) an image as possible. I have turned off Auto Exposure, Gain and White Balance and am using the 'save' and 'load' method of IVCDPropertyItems to store this information in an xml file.

Some parameters exposed in the program VCD Property Inspector in Imaging Control 3.1 have parameters that are not accessible using this method: The White Balance with Auto=off still has parameters that can change: White Balance Red and White Balance Blue. What seems the most critical for my application is the Auto Max Value under Exposure. I have not found a way to control these under programmatic control via the xml file or in C++ code. Is there a means to do so?

Additionally, can the exposure values be set in absolute values in the xml file rather than the relative gain value?

Stefan Geissler
October 30, 2009, 13:27:01
Hello,

first of all Exposure:



//////////////////////////////////////////////////////////////////////
// Set exposure using the range interface. For the AF/BF cameras
// the exposure range is 0.00001 to 30.0.
//
// In order to set 1/2000 seconds, call:
// SetExposureAbsolute( pGrabber, 0.002);
//
bool SetExposureAbsolute( DShowLib::Grabber *pGrabber, double dExposure )
{
bool bOK = false;
DShowLib::tIVCDAbsoluteValuePropertyPtr pExposureRange;
DShowLib::tIVCDSwitchPropertyPtr pExposureAuto;

pExposureRange = NULL;
pExposureAuto = NULL;

tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
if( pItems != 0 )
{
// Try to find the exposure item.
tIVCDPropertyItemPtr pExposureItem = pItems->findItem( VCDID_Exposure );
if( pExposureItem != 0 )
{
// Try to find the value and auto elements
tIVCDPropertyElementPtr pExposureValueElement = pExposureItem->findElement( VCDElement_Value );
tIVCDPropertyElementPtr pExposureAutoElement = pExposureItem->findElement( VCDElement_Auto );

// If an auto element exists, try to acquire a switch interface
if( pExposureAutoElement != 0 )
{
pExposureAutoElement->getInterfacePtr( pExposureAuto );
pExposureAuto->setSwitch(false); // Disable auto, otherwise we can not set exposure.
}


// If a value element exists, try to acquire a range interface
if( pExposureValueElement != 0 )
{
pExposureValueElement->getInterfacePtr( pExposureRange );

double min = pExposureRange->getRangeMin();
double max = pExposureRange->getRangeMax();

if ( dExposure < min )
{
dExposure = min;
}
else if( dExposure > max )
{
dExposure = max;
}

// Here we set the the exposure value.
pExposureRange->setValue( dExposure);
bOK = true;
}
}
}
return bOK;
}


For whitebalance: Please check, which "vda" file versions are installed in the "bin" directory of IC Imaging Control and which versions are installed in the "classlib\debug" resp. "classlib\release" directory. Please keep in mind, these files are needed to access all camera properties. If they are missing for your application, the you have only some nice DirectShow standard properties.