IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Mask filter (two input images)See full documentation
imagemaskImgImg (inImg1,inImg2,inMaskImg)

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

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

Header file

#include <IPSDKIPL/IPSDKIPLLogical/Processor/MaskImgImg/MaskImgImg.h>

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);