The ROI filter cuts a region of interest out of the incoming frames. It creates a new output video format.
The ROI filter is loaded by an application using following code:
// Load the ROI filter from the stdfilters.ftf module. #ifdef _DEBUG smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "ROI", // Filter name. "stdfiltersd.ftf" ); // Module file. #else smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "ROI", // Filter name. "stdfilters.ftf" ); // Module file. #endif
The part of the image that is copied to the destination frame is determined by four filter parameters:
The dimensions and the start positions of the region of interest can be specified in the ROI filter's property dialog:
The following source code can be used, if the parameter should be set by an application:
long lLeft = 0; long lTop = 0; long lHeight = 0; long lWidth = 0; // Retrieve the current ROI rectangle: pFilter->getParameter( "Left", lLeft ); pFilter->getParameter( "Top", lTop ); pFilter->getParameter( "Height",lHeight ); pFilter->getParameter( "Width", lWidth ); // Set a new ROI. lLeft = 100; lTop = 50; // The position of the ROI can be set, regardless of whether the live video is running // because the size of the resulting video format is not changed. pFilter->setParameter( "Left", lLeft ); pFilter->setParameter( "Top", lTop ); if( m_Grabber.isLive() == false ) { // A new ROI width and height can only be set while the live video is stopped. Otherwise, // an error is returned by setParameter(). lHeight = 120; lWidth = 180; pFilter->setParameter( "Height",lHeight ); pFilter->setParameter( "Width", lWidth ); }