PDA

View Full Version : Partial offset not working?



yan_zhao_ep
July 15, 2014, 16:48:07
Hi,

I modified the SetAbsoluteExposure function to change the partial scan offset (code below), but the following two lines return NULL... The camera is a DFK 23UP031.

Please advise.






tIVCDPropertyElementPtr pScanValueElement = pScanItem->findElement( VCDElement_Value ); // returns NULL
tIVCDPropertyElementPtr pScanAutoElement = pScanItem->findElement( VCDElement_Auto ); // returns NULL




tIVCDAbsoluteValuePropertyPtr pScanRangeX = NULL;
tIVCDAbsoluteValuePropertyPtr pScanRangeY = NULL;
tIVCDSwitchPropertyPtr pScanAuto = NULL;

tIVCDPropertyItemsPtr pItems = m_pGrabber->getAvailableVCDProperties();
if( pItems != 0 )
{
// Try to find the Scan item.
tIVCDPropertyItemPtr pScanItem = pItems->findItem( VCDID_PartialScanOffset );
if( pScanItem != 0 )
{
// Try to find the value and auto elements
tIVCDPropertyElementPtr pScanValueElement = pScanItem->findElement( VCDElement_Value ); // returns NULL
tIVCDPropertyElementPtr pScanAutoElement = pScanItem->findElement( VCDElement_Auto ); // returns NULL

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


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

double dfMaxX = pScanRangeX->getRangeMax();
double dfMaxY = pScanRangeY->getRangeMax();
double dfMinX = pScanRangeX->getRangeMin();
double dfMinY = pScanRangeY->getRangeMin();

if( x <= dfMaxX && x >= dfMinX &&
y <= dfMaxY && y >= dfMinY )
{
pScanRangeX->setValue(x);
pScanRangeY->setValue(y);

return S_OK;
}
}
}
}

Stefan Geissler
July 15, 2014, 17:33:37
Hi

Partial scan has not an "auto" property at all..... The VCD Propterty Inpector of IC Imaging Control shows, which properties are available.
Here are all functions for partial scan:



bool Is_Partial_scan_Auto_center_Available(Grabber* pGrabber)
{
bool bResult = false;
if( pGrabber->isDevValid() )
{
tIVCDSwitchPropertyPtr pSwitchItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanAutoCenter ,pSwitchItf);

if( pSwitchItf != NULL )
{
bResult = true;
}
}

return bResult;
}


bool Get_Partial_scan_Auto_center(Grabber* pGrabber)
{
if( pGrabber->isDevValid() )
{
tIVCDSwitchPropertyPtr pSwitchItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanAutoCenter ,pSwitchItf);

if( pSwitchItf != NULL )
{
return pSwitchItf->getSwitch();
}
}

return false;
}

void Set_Partial_scan_Auto_center(Grabber* pGrabber, bool OnOff)
{
if( pGrabber->isDevValid() )
{
tIVCDSwitchPropertyPtr pSwitchItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanAutoCenter ,pSwitchItf);

if( pSwitchItf != NULL )
{
pSwitchItf->setSwitch(OnOff);
}
}
}

bool Is_Partial_scan_X_Offset_Available(Grabber* pGrabber)
{
bool bResult = false;
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetX ,pRangeItf);

if( pRangeItf != NULL )
{
bResult = true;
}
}

return bResult;
}


long Get_Partial_scan_X_Offset_Value(Grabber* pGrabber)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetX ,pRangeItf);

if( pRangeItf != NULL )
{
return pRangeItf->getValue();
}
}

return 0;
}

void Set_Partial_scan_X_Offset_Value(Grabber* pGrabber, long Value)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetX ,pRangeItf);

if( pRangeItf != NULL )
{
pRangeItf->setValue(Value);
}
}
}

long Get_Partial_scan_X_Offset_Min(Grabber* pGrabber)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetX ,pRangeItf);

if( pRangeItf != NULL )
{
return pRangeItf->getRangeMin();
}
}
bool Is_Partial_scan_Y_Offset_Available(Grabber* pGrabber)
{
bool bResult = false;
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetY ,pRangeItf);

if( pRangeItf != NULL )
{
bResult = true;
}
}

return bResult;
}


long Get_Partial_scan_Y_Offset_Value(Grabber* pGrabber)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetY ,pRangeItf);

if( pRangeItf != NULL )
{
return pRangeItf->getValue();
}
}

return 0;
}

void Set_Partial_scan_Y_Offset_Value(Grabber* pGrabber, long Value)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetY ,pRangeItf);

if( pRangeItf != NULL )
{
pRangeItf->setValue(Value);
}
}
}

long Get_Partial_scan_Y_Offset_Min(Grabber* pGrabber)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetY ,pRangeItf);

if( pRangeItf != NULL )
{
return pRangeItf->getRangeMin();
}
}

return 0;
}

long Get_Partial_scan_Y_Offset_Max(Grabber* pGrabber)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetY ,pRangeItf);

if( pRangeItf != NULL )
{
return pRangeItf->getRangeMax();
}
}

return 0;
}



You must call
Set_Partial_scan_Auto_center(&Grabber,false);
first. Then you can set the offsets.