IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Subtract two binary image to remove pixels in the image 2 from the image 1. More...

IPSDKIPLLOGICAL_API image::ImagePtr ipsdk::imaproc::logic::bitwiseSubImgImg (const image::ImageConstPtr &pInIntImg1, const image::ImageConstPtr &pInIntImg2)
 wrapper function for Subtract two binary image to remove pixels in the image 2 from the image 1 More...
 
IPSDKIPLLOGICAL_API void ipsdk::imaproc::logic::bitwiseSubImgImg (const image::ImageConstPtr &pInIntImg1, const image::ImageConstPtr &pInIntImg2, const image::ImagePtr &pOutImg)
 wrapper function for Subtract two binary image to remove pixels in the image 2 from the image 1 More...
 

Detailed Description

Subtract two binary image to remove pixels in the image 2 from the image 1.

This algorithm computes a bitwise butraction between two images. The bitwise subtraction is given by the formula :

\[ OutImg[i] = InIntImg1[i] {\land} (\lnot InIntImg2[i]) \]

A Bitwise sub operator applied to 2 integers performs the logical and operation on each pair of corresponding bits of the binary representation of these 2 integers. As shown in the truth table below, the result in each position is 1 if the first bit is 1 and the second bit is 1; otherwise, the result is 0.

Input bit #1 Input bit #2 Output bit :
0 0 0
0 1 0
1 0 1
1 1 0

Here is an example of a Bitwise sub operation applied to two 2D binary images (black pixels have value 0, white pixels have value 1):

bitwiseSubExample.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InIntImg1 [Input] First image for processing operation (data contained in image buffer are integers) X
ipsdk::imaproc::attr::InIntImg2 [Input] Second image for processing operation (data contained in image buffer are integers) X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation ipsdk::imaproc::duplicateInOut (_pOutImg, _pInIntImg1)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSizeAndType (_pInIntImg1,_pInIntImg2,_pOutImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLLogical as logic

Code Example

# bitwize 'sub' computation
outImg = logic.bitwiseSubImgImg(inImg1, inImg2)

Example of C++ code :

Example informations

Associated library

IPSDKIPLLogical

Header file

Code Example

// Sample with a generated output image
// ------------------------------------
// compute addition of input images
ImagePtr pAutoOutImg = bitwiseSubImgImg(pInImg1, pInImg2);
// Sample with a provided output image
// -----------------------------------
// create output image
ImageGeometryPtr pOutputImageGeometry = geometry2d(eImageBufferType::eIBT_Binary, sizeX, sizeY);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(*pOutputImageGeometry);
// compute addition of input images
bitwiseSubImgImg(pInImg1, pInImg2, pOutImg);
See also
BitwiseSubImgImgLvl1
BitwiseSubImgImgLvl2
BitwiseSubImgImgLvl3

Function Documentation

◆ bitwiseSubImgImg() [1/2]

IPSDKIPLLOGICAL_API image::ImagePtr ipsdk::imaproc::logic::bitwiseSubImgImg ( const image::ImageConstPtr pInIntImg1,
const image::ImageConstPtr pInIntImg2 
)

wrapper function for Subtract two binary image to remove pixels in the image 2 from the image 1

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ bitwiseSubImgImg() [2/2]

IPSDKIPLLOGICAL_API void ipsdk::imaproc::logic::bitwiseSubImgImg ( const image::ImageConstPtr pInIntImg1,
const image::ImageConstPtr pInIntImg2,
const image::ImagePtr pOutImg 
)

wrapper function for Subtract two binary image to remove pixels in the image 2 from the image 1

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure