IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Bitwise exclusive or operation on 2 input images More...

IPSDKIPLLOGICAL_API image::ImagePtr ipsdk::imaproc::logic::bitwiseXOrImgImg (const image::ImageConstPtr &pInIntImg1, const image::ImageConstPtr &pInIntImg2)
 wrapper function for bitwise exclusive or operation on 2 images, pixel by pixel More...
 
IPSDKIPLLOGICAL_API void ipsdk::imaproc::logic::bitwiseXOrImgImg (const image::ImageConstPtr &pInIntImg1, const image::ImageConstPtr &pInIntImg2, const image::ImagePtr &pOutImg)
 wrapper function for bitwise exclusive or operation on 2 images, pixel by pixel More...
 

Detailed Description

Bitwise exclusive or operation on 2 input images

On output image values are given by:

\[ OutImg[i] = InIntImg1[i] {\wedge} InIntImg2[i] \]

(with $\wedge$ corresponding to the Bitwise xor operator)

Input and output images must have same size and buffer type. Buffers must be of type integer

A Bitwise xor operator applied to 2 integers performs the logical exclusive or 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 one and ONLY one bit among the 2 bits is 1; otherwise, the result is 0.

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

For instance, if we compute the result of a Bitwise xor on the two integers 5 and 3, we obtain;

  0101 (decimal 5)
^ 0011 (decimal 3)
= 0110 (decimal 6)
See also
"Bitwise operation --- Wikipedia, The Free Encyclopedia", 2014, http://en.wikipedia.org/w/index.php?title=Bitwise_operation&oldid=604175200

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

bitwiseXOrExample.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

# opening of input images
inImg1 = PyIPSDK.loadTiffImageFile(inputImgPath1)
inImg2 = PyIPSDK.loadTiffImageFile(inputImgPath2)
# bitwize 'xor' computation
outImg = logic.bitwiseXOrImgImg(inImg1, inImg2)

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);
// compute bitwise exclusive or on input images
ImagePtr pOutImg = bitwiseXOrImgImg(pInImg1, pInImg2);
See also
BitwiseXOrImgImgLvl1
BitwiseXOrImgImgLvl2
BitwiseXOrImgImgLvl3

Function Documentation

◆ bitwiseXOrImgImg() [1/2]

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

wrapper function for bitwise exclusive or operation on 2 images, pixel by pixel

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ bitwiseXOrImgImg() [2/2]

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

wrapper function for bitwise exclusive or operation on 2 images, pixel by pixel

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure