IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

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

IPSDKIPLUTILITY_API image::ImagePtr ipsdk::imaproc::util::getROI2dImg (const image::ImageConstPtr &pInImg, ipUInt64 xOffset, ipUInt64 yOffset, ipUInt64 xSz, ipUInt64 ySz)
 wrapper function for 2d ROI extraction algorithm More...
 
IPSDKIPLUTILITY_API void ipsdk::imaproc::util::getROI2dImg (const image::ImageConstPtr &pInImg, ipUInt64 xOffset, ipUInt64 yOffset, ipUInt64 xSz, ipUInt64 ySz, const image::ImagePtr &pOutImg)
 wrapper function for 2d ROI extraction algorithm More...
 

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

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InInputImg2dOffset [Input] input image 2d offset X
ipsdk::imaproc::attr::InOutputImg2dSize [Input] output image 2d size X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation customOutput (_pOutImg, outputROI2d(_pInImg,_pInOutputImg2dSize))

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchBufferType (_pInImg,_pOutImg) && 
ipsdk::imaproc::noInSitu (_pInImg,_pOutImg) && 
ipsdk::imaproc::customImageProperty (_pInImg,
 ipsdk::imaproc::util::containsROI2d (_pInImg,_pInInputImg2dOffset,_pInOutputImg2dSize)) && 
ipsdk::imaproc::customImageProperty (_pOutImg,
 ipsdk::imaproc::util::matchROI2d (_pInOutputImg2dSize)) && 
ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_ZCT,_pInImg,_pOutImg)

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

Associated library

IPSDKIPLUtility

Header file

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);
See also
GetROI2dImgLvl1
GetROI2dImgLvl2
GetROI2dImgLvl3

Function Documentation

◆ getROI2dImg() [1/2]

IPSDKIPLUTILITY_API image::ImagePtr ipsdk::imaproc::util::getROI2dImg ( const image::ImageConstPtr pInImg,
ipUInt64  xOffset,
ipUInt64  yOffset,
ipUInt64  xSz,
ipUInt64  ySz 
)

wrapper function for 2d ROI extraction algorithm

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ getROI2dImg() [2/2]

IPSDKIPLUTILITY_API void ipsdk::imaproc::util::getROI2dImg ( const image::ImageConstPtr pInImg,
ipUInt64  xOffset,
ipUInt64  yOffset,
ipUInt64  xSz,
ipUInt64  ySz,
const image::ImagePtr pOutImg 
)

wrapper function for 2d ROI extraction algorithm

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure