IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

algorithm allowing to invert 2d image intensity More...

IPSDKIPLINTENSITYTRANSFORM_API image::ImagePtr ipsdk::imaproc::itrans::invert2dImg (const image::ImageConstPtr &pInImg)
 wrapper function for algorithm allowing to invert 2d image intensity More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::invert2dImg (const image::ImageConstPtr &pInImg, const image::ImagePtr &pOutImg)
 wrapper function for algorithm allowing to invert 2d image intensity More...
 

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.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation duplicateInOut (_pOutImg, _pInImg)

Global Rule description

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

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

Associated library

IPSDKIPLIntensityTransform

Header file

Code Example

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

Function Documentation

◆ invert2dImg() [1/2]

IPSDKIPLINTENSITYTRANSFORM_API image::ImagePtr ipsdk::imaproc::itrans::invert2dImg ( const image::ImageConstPtr pInImg)

wrapper function for algorithm allowing to invert 2d image intensity

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ invert2dImg() [2/2]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::invert2dImg ( const image::ImageConstPtr pInImg,
const image::ImagePtr pOutImg 
)

wrapper function for algorithm allowing to invert 2d image intensity

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure