IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Greyscale inversion of 2d imageSee full documentation
imageinvert2dImg (inImg)

Detailed Description

algorithm allowing to invert 2d image intensity

Given an input image $InImg$, output image $OutImg$ as follow :

\[ OutImg[i] = K - InImg[i] \]

where $K = \min\{InImg\} + \max\{InImg\}$ is defined from input image extrema.

This transformation allows to preserve image range since :

Here is an example of 2d image greyscale inversion applied to a 8-bits grey level image :

invert2dImg_grey.png

During this transformation, image histogram is mirrored around mean input range $\frac{\min\{InImg\} + \max\{InImg\}}{2}$ :

invert2dImg_grey_histogram.png

In this case algorithm is independently applied plan by plan (ie image extrema are computed and applied plan by plan), for a 3d version of this algorithm see Greyscale inversion of 3d image.

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLIntensityTransform as itrans

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# greyscale inversion of input image
outImg = itrans.invert2dImg(inImg)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLIntensityTransform/Processor/Invert2dImg/Invert2dImg.h>

Code Example

// opening of input image
ImagePtr pInImg = loadTiffImageFile(inputGreyImgPath);
// greyscale inversion of input image
ImagePtr pOutImg = invert2dImg(pInImg);