IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Mask filter (two input images)

Mask filter, computing an output image for which each pixel equals to corresponding pixel in either first or second input image, depending on whether corresponding input mask image pixel equals 1 or 0 algorithm. More...

IPSDKIPLLOGICAL_API void ipsdk::imaproc::logic::maskImgImg (const image::ImageConstPtr &pInImg1, const image::ImageConstPtr &pInImg2, const image::ImageConstPtr &pInMaskImg, const image::ImagePtr &pOutImg)
 wrapper function for Mask filter, computing an output image for which each pixel equals to corresponding pixel in either first or second input image, depending on whether corresponding input mask image pixel equals 1 or 0 More...
 
IPSDKIPLLOGICAL_API image::ImagePtr ipsdk::imaproc::logic::maskImgImg (const image::ImageConstPtr &pInImg1, const image::ImageConstPtr &pInImg2, const image::ImageConstPtr &pInMaskImg)
 wrapper function for Mask filter, computing an output image for which each pixel equals to corresponding pixel in either first or second input image, depending on whether corresponding input mask image pixel equals 1 or 0 More...
 

Detailed Description

Mask filter, computing an output image for which each pixel equals to corresponding pixel in either first or second input image, depending on whether corresponding input mask image pixel equals 1 or 0 algorithm.

compute an output image for which each pixel equals to corresponding pixel in either first or second input image, depending on whether corresponding input mask image pixel equals 1 or 0 algorithm

On output image values are given by:

\[ OutImg[i] = \begin{cases} InImg1[i], & \text{if }InMaskImg[i] \text{ equals } 1 \\ InImg2[i], & \text{if } InMaskImg[i] \text{ equals } 0\end{cases} \]

Input, mask and output images must have same size. Input and output image buffers must have same type

Here is an example of this mask filter applied to two 8-bits grey level images:

maskImgImgExample.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg1 [Input] First image for processing operation X
ipsdk::imaproc::attr::InImg2 [Input] Second image for processing operation X
ipsdk::imaproc::attr::InMaskImg [Input] Binary image for masking operation X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation ipsdk::imaproc::duplicateInOut (_pOutImg, _pInImg1)

Global Rule description

Global rule description for algorithm :
(ipsdk::processor::If (
  ipsdk::imaproc::is2d (_pInMaskImg),
  ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_2d,_pInImg1,_pInMaskImg),
  ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_3d,_pInImg1,_pInMaskImg))) && 
ipsdk::imaproc::matchSize (_pInImg1,_pInImg2,_pOutImg) && 
ipsdk::imaproc::matchBufferType (_pInImg1,_pInImg2,_pOutImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLLogical as logic
import PyIPSDK.IPSDKIPLBinarization as bin

Code Example

# opening of input images
inImg1 = PyIPSDK.loadTiffImageFile(inputImgPath1)
inImg2 = PyIPSDK.loadTiffImageFile(inputImgPath2)
# creation of a mask
inMaskImg, otsuValue = bin.otsuThresholdImg(inImg1)
# mask image image computation
outImg = logic.maskImgImg(inImg1, inImg2, inMaskImg)

Example of C++ code :

Example informations

Associated library

IPSDKIPLLogical

Header file

Code Example

// open input images
ImageGeometryPtr pImageGeometry = geometry2d(inType, sizeX, sizeY);
ImagePtr pInImg1 = loadRawImageFile(in1Path, *pImageGeometry);
ImagePtr pInImg2 = loadRawImageFile(in2Path, *pImageGeometry);
ImageGeometryPtr pMaskImageGeometry = geometry2d(eImageBufferType::eIBT_Binary, sizeX, sizeY);
ImagePtr pInMask = loadRawImageFile(inMaskPath, *pMaskImageGeometry);
// compute mask on input images
ImagePtr pOutImg = maskImgImg(pInImg1, pInImg2, pInMask);
See also
MaskImgImgLvl1
MaskImgImgLvl3

Function Documentation

◆ maskImgImg() [1/2]

IPSDKIPLLOGICAL_API void ipsdk::imaproc::logic::maskImgImg ( const image::ImageConstPtr pInImg1,
const image::ImageConstPtr pInImg2,
const image::ImageConstPtr pInMaskImg,
const image::ImagePtr pOutImg 
)

wrapper function for Mask filter, computing an output image for which each pixel equals to corresponding pixel in either first or second input image, depending on whether corresponding input mask image pixel equals 1 or 0

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ maskImgImg() [2/2]

IPSDKIPLLOGICAL_API image::ImagePtr ipsdk::imaproc::logic::maskImgImg ( const image::ImageConstPtr pInImg1,
const image::ImageConstPtr pInImg2,
const image::ImageConstPtr pInMaskImg 
)

wrapper function for Mask filter, computing an output image for which each pixel equals to corresponding pixel in either first or second input image, depending on whether corresponding input mask image pixel equals 1 or 0

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure