IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

computation of the absolute value of an image, pixel by pixel algorithm More...

IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::absImg (const image::ImageConstPtr &pInImg)
 wrapper function for computation of the absolute value of an image, pixel by pixel More...
 
IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::absImg (const image::ImageConstPtr &pInImg, const image::ImagePtr &pOutImg)
 wrapper function for computation of the absolute value of an image, pixel by pixel More...
 

Detailed Description

computation of the absolute value of an image, pixel by pixel algorithm

On output image values are given by:

\[ OutImg[i] = \lvert InImg[i]\rvert \]

, with

\[ \lvert InImg[i]\rvert = \begin{cases} InImg[i], & \text{if }InImg[i] \geq 0 \\ -InImg[i], & \text{otherwise} \end{cases} \]

Input and output images must have same size.

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 promoteUnary (_pOutImg, _pInImg, ipsdk::imaproc::ePromoteUnaryType::ePUT_Unsigned)

Global Rule description

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

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLArithmetic as arithm

Code Example

# opening of input image
geometry = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_Int8, 510, 509)
inImg = PyIPSDK.loadRawImageFile(inputImgPath, geometry)
# computation of image absolute value
outImg = arithm.absImg(inImg)

Example of C++ code :

Example informations

Associated library

IPSDKIPLArithmetic

Header file

Code Example

// open input image
ImageGeometryPtr pInputImageGeometry = geometry2d(inType, sizeX, sizeY);
ImagePtr pInImg = loadRawImageFile(inPath, *pInputImageGeometry);
// Sample with a generated output image
// ------------------------------------
// compute absolute value of input image
ImagePtr pAutoOutImg = absImg(pInImg);
// Sample with a provided output image
// -----------------------------------
// create output image
ImageGeometryPtr pOutputImageGeometry = geometry2d(outType, sizeX, sizeY);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(*pOutputImageGeometry);
// compute absolute value of input image
absImg(pInImg, pOutImg);
See also
AbsImgLvl1
AbsImgLvl2
AbsImgLvl3

Function Documentation

◆ absImg() [1/2]

IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::absImg ( const image::ImageConstPtr pInImg)

wrapper function for computation of the absolute value of an image, pixel by pixel

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ absImg() [2/2]

IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::absImg ( const image::ImageConstPtr pInImg,
const image::ImagePtr pOutImg 
)

wrapper function for computation of the absolute value of an image, pixel by pixel

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure