IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

local energy on a 2d image More...

IPSDKIPLSTATS_API image::ImagePtr ipsdk::imaproc::stats::localEnergy2dImg (const image::ImageConstPtr &pInImg, const ipUInt32 inHalfKnlSizeX, const ipUInt32 inHalfKnlSizeY)
 wrapper function for local energy on a 2d image More...
 
IPSDKIPLSTATS_API image::ImagePtr ipsdk::imaproc::stats::localEnergy2dImg (const image::ImageConstPtr &pInImg, const ipUInt32 inHalfKnlSizeX, const ipUInt32 inHalfKnlSizeY, const ipUInt32 inOptNbClasses)
 wrapper function for local energy on a 2d image More...
 
IPSDKIPLSTATS_API void ipsdk::imaproc::stats::localEnergy2dImg (const image::ImageConstPtr &pInImg, const ipUInt32 inHalfKnlSizeX, const ipUInt32 inHalfKnlSizeY, const ipUInt32 inOptNbClasses, const image::ImagePtr &pOutImg)
 wrapper function for local energy on a 2d image More...
 

Detailed Description

local energy on a 2d image

This algorithm computes for each pixel of the output image its associated local energy on a rectangular neighbourhood.

The more homogeneous is the neighbourhood, the higher will be the local energy.

Given an input image $InImg$, rectangular kernel half sizes $N_x = InHalfKnlSizeX$ and $N_y = InHalfKnlSizeY$ and a number of classes $n$, output image values are given by :

\[ OutImg[x, y] = \sum_{i=0}^{n}{p^2(i)} \]

where $p(i)$ is the probability deduced from the neighbourhood histogram $H = \left[ h_1, h_2, ..., h_n \right]$ by $p_i = \dfrac {h_{i}} {N_x.N_y}$.

The histogram is computed on the rectangular kernel, with the following parameters:

The number of classes is an optional parameter of the algorithm. Its default value equals to 16. If the number of classes specified by the user exceeds the maximum allowed number of classes given the input image data type and dynamic range, it is automatically adjusted. For instance:

The borders of the input image are handled by padding pixels with a mirror reflection of the border pixels in the input image (see Border policy for more details).

Here is an example of an output image computed from the LocalEnergy2dImg algorithm on a 8-bits grey level, with a kernel of size 3x3 pixels and 16 classes:

localEnergy2dImg.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InHalfKnlSizeX [Input] half kernel size along X axis for operation X
ipsdk::imaproc::attr::InHalfKnlSizeY [Input] half kernel size along Y axis for operation X
ipsdk::imaproc::attr::InOptNbClasses [Input Optional] number of classes X
ipsdk::imaproc::attr::OutRealImg [Output] image for processing operation (data contained in image buffer are reals) ipsdk::imaproc::duplicateInOut (_pOutRealImg, _pInImg, image::eImageBufferType::eIBT_Real32)

Global Rule description

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

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLStats as stats

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# local entropy 2d image computation
outImg = stats.localEnergy2dImg(inImg, 3, 3)

Example of C++ code :

Example informations

Associated library

IPSDKIPLStats

Header file

Code Example

// compute local energy on input image
ImagePtr pOutImg = localEnergy2dImg(pInImg, inHalfKnlSizeX, inHalfKnlSizeY, nbClasses);
See also
LocalEnergy2dImgLvl1
LocalEnergy2dImgLvl2
LocalEnergy2dImgLvl3

Function Documentation

◆ localEnergy2dImg() [1/3]

IPSDKIPLSTATS_API image::ImagePtr ipsdk::imaproc::stats::localEnergy2dImg ( const image::ImageConstPtr pInImg,
const ipUInt32  inHalfKnlSizeX,
const ipUInt32  inHalfKnlSizeY 
)

wrapper function for local energy on a 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ localEnergy2dImg() [2/3]

IPSDKIPLSTATS_API image::ImagePtr ipsdk::imaproc::stats::localEnergy2dImg ( const image::ImageConstPtr pInImg,
const ipUInt32  inHalfKnlSizeX,
const ipUInt32  inHalfKnlSizeY,
const ipUInt32  inOptNbClasses 
)

wrapper function for local energy on a 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ localEnergy2dImg() [3/3]

IPSDKIPLSTATS_API void ipsdk::imaproc::stats::localEnergy2dImg ( const image::ImageConstPtr pInImg,
const ipUInt32  inHalfKnlSizeX,
const ipUInt32  inHalfKnlSizeY,
const ipUInt32  inOptNbClasses,
const image::ImagePtr pOutImg 
)

wrapper function for local energy on a 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure