User`s guide
Supporting ROIs
5-25
Note You use the ROI width and height when you create the frame but you use the full
image width and height when you copy the image data from the buffer into the frame
object.
Example
The following is a version of the isSendFrame() loop in the acquisition thread function
that checks the ROI. Note that you call the getROI() function to get the ROI values, and
then use the width and height values in the call to makeFrame() and the offsets from the
origin in the call to setImage().
if (adaptor->isSendFrame()) {
// Get ROI information.
int roiOriginX, roiOriginY, roiWidth, roiHeight;
adaptor->getROI(roiOriginX,
roiOriginY,
roiWidth,
roiHeight);
// Get frame type & dimensions
imaqkit::frametypes::FRAMETYPE frameType =
adaptor->getFrameType();
int imWidth = adaptor->getMaxWidth();
int imHeight = adaptor->getMaxHeight();
// Create a frame object
imaqkit::IAdaptorFrame* frame =
adaptor->getEngine()->makeFrame(frameType,
roiWidth, // ROI width
roiHeight); // ROI height
// Copy data from buffer into frame object
frame->setImage(imBuffer,
imWidth, // Full image width
imHeight, // Full image height
roiOriginX, // ROI origin
roiOriginY); // ROI origin
// Set image's timestamp
frame->setTime(imaqkit::getCurrentTime());
// Send frame object to engine.
adaptor->getEngine()->receiveFrame(frame);