View Full Version : Switching between pixel modes

October 29, 2008, 19:25:23
I want automate switching between BY8 and UYVY modes. As a base I have "pixel inverting app" that c++ wizard creates.
I would also need every time to change exposure to specific number.
How do I do that?

Stefan Geissler
October 30, 2008, 08:11:18

for changing the video format, you must call "livesstop", then set the new video format and start the live video (livestart) again.

The exposure time can be changed without stopping and starting the live video. If you want to set the exposure time with absolute values, you may use following function:

// 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;

October 30, 2008, 14:36:43
Thank you for the exposure code!

I already did the changing pixel format with stopping and starting video but it had not the results I expected.
I would like to still use eRGB24 for easiest information processing but I need to switch between:
UYVY mode for capturing color (15fps) then switch to
Y800 for shape processing since it has 30fps (DFK 31BF03) and no color interpolation

I don't need to switch fast between them but I need to automate it so the user don't need to change format in Device dialog.

As I see both modes work with eRGB24 I just want to avoid button clicks Device->change video format

Stefan Geissler
October 30, 2008, 16:02:49
So I understand, your problem is solved now?