IPSDK 0.2
IPSDK : Image Processing Software Development Kit
imagebitwiseNotImg (inIntImg)

Detailed Description

Bitwise not operation on one input image

If the input and output images buffer types are ipsdk::image::eImageBufferType::eIBT_Binary, then the operator ipsdk::imaproc::logic::logicalNotImg can be applied instead.

On output image values are given by:

\[ OutImg[i] = {\sim}(InIntImg[i]) \]

(with $\sim$ corresponding to the Bitwise not operator).

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

A Bitwise not operator applied to one integer performs the logical not operation on each bit of the binary representation of this integer. As shown in the truth table below, the result in each position is 1 if the bit is 0; otherwise, the result is 0.

Input bit Output bit
0 1
1 0

For instance, if we compute the result of a Bitwise not on the integer 5, we obtain;

  ! 0101 (decimal  5)
  = 1010 (decimal 10)
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 not operation applied to one 2D binary image (black pixels have value 0, white pixels have value 1) :

bitwiseNotExample.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLLogical as logic

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# bitwize 'not' computation
outImg = logic.bitwiseNotImg(inImg)

Example of C++ code :

Example informations

Header file

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

Code Example

// open input image
ImageGeometryPtr pImageGeometry = geometry2d(inType, sizeX, sizeY);
ImagePtr pInImg = loadRawImageFile(inPath, *pImageGeometry);
// compute bitwise not operation on input image
ImagePtr pOutImg = bitwiseNotImg(pInImg);