void | putROI2dImg (inOutImg,inRoiImg,xOffset,yOffset) |
void | putROI2dImg (inImg,inRoiImg,xOffset,yOffset,outImg) |
Algorithm allowing to set the the 2d ROI of an image with the content of another image.
This algorithm to set the the 2d ROI of an image (InImg) with the content of another image (InROIImg). The ROI is delimited by a rectangle, defined by the attribute InInputImg2dOffset and by the size of the ROI image.
InImg and OutImg have the same type and size
InImg and InROIImg have the same type, and the size of InROIImg cannot exceed the size of InImg
On output image, values are given by :
,
with
and
the sizes of InROIImg image along x-axis and y-axis, respectively.
An example of 2d ROI extraction is shown below, with the following parameters:
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLUtility as util
Code Example
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
inROIImg = PyIPSDK.loadTiffImageFile(inputROIImgPath)
outGeometry = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_UInt8, 510, 509)
outImg = PyIPSDK.createImage(outGeometry)
util.putROI2dImg(inImg, inROIImg, 400, 401, outImg)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLUtility/Processor/PutROI2dImg/PutROI2dImg.h>
Code Example
if(pInImg->getBufferType() != imageBufferType)
if(pInROIImg->getBufferType() != imageBufferType)
pInROIImg =
convertImg(pInROIImg, imageBufferType);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(pInImg->getGeometry());
putROI2dImg(pInImg, pInROIImg, inOffsetX, inOffsetY, pOutImg);