Zum Hauptinhalt springen

How to move an ROI on the sensor using IC Imaging Control - Wissensdatenbank / Programming - The Imaging Source Helpdesk

How to move an ROI on the sensor using IC Imaging Control

Autorenliste

By default, the ROI is centered on the sensor. In order to move the ROI on the sensor the Partcial Scan Auto Center property must be set to false. Then you can move the ROI using the Partial Scan Offset X and Partial Scan Offset Y properties of the camera.

The C++ source code for doing is as follows. First of all we implement the helper functions for the properties:


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);
    }
    }
}

void Set_Partial_scan_Offset_Valuex(Grabber* pGrabber, long X, long Y)
{
    if( pGrabber->isDevValid() )
    {
    tIVCDRangePropertyPtr pRangeItf;
    tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
    pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetX ,pRangeItf);
    if( pRangeItf != NULL )
    {
    pRangeItf->setValue(X);
    }
    pItems->findInterfacePtr(VCDID_PartialScanOffset, VCDElement_PartialScanOffsetY ,pRangeItf);
    if( pRangeItf != NULL )
    {
    pRangeItf->setValue(Y);
    }
    }
}

The code is used as follows:

In the first step, you disable the auto center once.

Set_Partial_scan_Auto_center(&cGrabber, false);


Then you position your ROI using x and y coordinates:


void Set_Partial_scan_Offset_Valuex(&cGrabber, 10,20);
Hilfreich Nicht hilfreich