IPSDK 4.1.0.2
IPSDK : Image Processing Software Development Kit
Bitwise nxor
imagebitwiseNXOrImgImg (inIntImg1,inIntImg2)

Detailed Description

Bitwise nxor operation on 2 input images

On output image values are given by:

\[ OutImg[i] = {\sim}(InIntImg1[i] {\wedge} InIntImg2[i]) \]

(with $\sim$ corresponding to the Bitwise not operator and $\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 nxor operator applied to 2 integers performs the logical nand (abbreviation for "not 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 the two bits have the same value; otherwise, the result is 1.

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

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

   0101 (decimal 5)
!^ 0011 (decimal 3)
=  1001 (decimal 9)
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 nxor operation applied to two 2D binary images (black pixels have value 0, white pixels have value 1):

bitwiseNXOrExample.png

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 'nxor' computation
outImg = logic.bitwiseNXOrImgImg(inImg1, inImg2)

Example of C++ code :

Example informations

Header file

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

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 = bitwiseNXOrImgImg(pInImg1, pInImg2);