IPSDK 0.2
IPSDK : Image Processing Software Development Kit
imagegetROI2dImg (inImg,xOffset,yOffset,xSz,ySz)

Detailed Description

Algorithm allowing to copy a 2d ROI of an image.

This algorithm allows to copy the region of interest, delimited by a rectangle, of an image.
The rectangle is defined by the 2 attributes InInputImg2dOffset and InOutputImg2dSize.
Output image type is the same as input.
Size of output image is given by the InOutputImg2dSize attribute.

On output image, values are given by :

\[ OutImg[x, y] = InROIImg[x-InInputImg2dOffset::XOffset, y-InInputImg2dOffset::YOffset] \]

,

with:

An example of 2d ROI extraction is shown below on Lena image, with the following parameters:

getROI2dImg.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLUtility as util

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# 2d ROI extraction
outImg = util.getROI2dImg(inImg, 200, 210, 101, 102)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLUtility/Processor/GetROI2dImg/GetROI2dImg.h>

Code Example

// opening input image
ImageGeometryPtr pInImageGeometry = geometry2d(imageBufferType, inSizeX, inSizeY);
ImagePtr pInImg = loadRawImageFile(inputImgPath, *pInImageGeometry);
ImageGeometryPtr pOutImageGeometry = geometry2d(imageBufferType, outSizeX, outSizeY);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(*pOutImageGeometry);
// ROI extraction of image
getROI2dImg(pInImg, inOffsetX, inOffsetY, outSizeX, outSizeY, pOutImg);