IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

algorithm allowing to estimate probability density function of a 2d image More...

IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::KDEDataSetPtr ipsdk::imaproc::glbmsr::kernelDensityEstimator2d (const image::ImageConstPtr &pInImg)
 wrapper function for algorithm allowing to estimate probability density function of a 2d image More...
 
IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::KDEDataSetPtr ipsdk::imaproc::glbmsr::kernelDensityEstimator2d (const image::ImageConstPtr &pInImg, const ipUInt32 inOptKDENbSamples, const ipsdk::imaproc::attr::KDEBandwidthPolicyConstPtr &pInOptKDEBandwidthPolicy)
 wrapper function for algorithm allowing to estimate probability density function of a 2d image More...
 
IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::PlanIndexedKDEDataSetPtr ipsdk::imaproc::glbmsr::multiSlice_kernelDensityEstimator2d (const image::ImageConstPtr &pInImg)
 wrapper function for algorithm allowing to estimate probability density function of a 2d image More...
 
IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::PlanIndexedKDEDataSetPtr ipsdk::imaproc::glbmsr::multiSlice_kernelDensityEstimator2d (const image::ImageConstPtr &pInImg, const ipUInt32 inOptKDENbSamples, const ipsdk::imaproc::attr::KDEBandwidthPolicyConstPtr &pInOptKDEBandwidthPolicy)
 wrapper function for algorithm allowing to estimate probability density function of a 2d image More...
 

Detailed Description

algorithm allowing to estimate probability density function of a 2d image

This algorithm allows to estimate the probability density function associated to the grey level population of a 2d image. This algorithm is also known as Parzen Rosenblatt window method.

Given an input 2d image InImg, the algorithm samples InOptKDENbSamples image values and build an ouput 'by plan' kernel density estimator object OutPIKDEDataSet.

The kernel density estimator bandwidth parameter value is computed with respect to the InOptKDEBandwidthPolicy parameter value.

Given a collection of image samples ${x_i}, i\in [0, N[$ and $h$ a bandwith for density estimation, image density $\hat{f}_h(x)$ is estimated for a given grey level $x$ as :

\[ \hat{f}_h(x)=\frac{1}{N\times h}\sum_{i=0}^{N}{K\left (\frac{x-x_i}{h}\right)} \]

where kernel function $K()$ is the zero mean and unit standard deviation gaussian function given by :

\[ K(x)=\frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}x^2} \]

Here is an example results of kernel density estimation computed with default parameters, compared with a classical histogram computation method (Histogram measurement 2d) :

kernelDensityEstimator2d.png
See also
https://en.wikipedia.org/wiki/Kernel_density_estimation

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InOptKDENbSamples [Input Optional] number of sample for kernel density estimation X
ipsdk::imaproc::attr::InOptKDEBandwidthPolicy [Input Optional] policy used to compute smoothing bandwidth parameter during a kernel density estimation X
ipsdk::imaproc::attr::OutPIKDEDataSet [Output] plan indexed collection of kernel density estimator result data set ipsdk::imaproc::fromImage (_pOutPIKDEDataSet, _pInImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchImagePlans (_pOutPIKDEDataSet,_pInImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLGlobalMeasure as glbmsr

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
nbTotPixels = inImg.getGeometry().getNbPixels()
# computation of kernel density estimation
kdeDataSet = glbmsr.kernelDensityEstimator2d(inImg)
# extraction of associated histogram
binMin = 0
binMax = 255
binWidth = 2
estimHisto = PyIPSDK.generateHistogram(kdeDataSet,
binMin, binMax, binWidth,
nbTotPixels)

Example of C++ code :

Example informations

Associated library

IPSDKIPLGlobalMeasure

Header file

Code Example

// Load the input image
ImagePtr pInImg = loadTiffImageFile(inImgFilePath);
const ipUInt64 nbTotPixels = pInImg->getGeometry().getNbPixels();
// computation of kernel density estimation
KDEDataSetPtr pKDEDataSet = kernelDensityEstimator2d(pInImg);
// extraction of associated histogram
const ipReal64 binMin = 0;
const ipReal64 binMax = 255;
const ipReal64 binWidth = 2;
HistogramDataPtr pEstimHisto = generateHistogram(*pKDEDataSet,
binMin, binMax, binWidth,
nbTotPixels);
See also
KernelDensityEstimator2dLvl1
KernelDensityEstimator2dLvl2

Function Documentation

◆ kernelDensityEstimator2d() [1/2]

IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::KDEDataSetPtr ipsdk::imaproc::glbmsr::kernelDensityEstimator2d ( const image::ImageConstPtr pInImg)

wrapper function for algorithm allowing to estimate probability density function of a 2d image

Note
This wrapper must be used with mono slice input images
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_kernelDensityEstimator2d() [1/2]

IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::PlanIndexedKDEDataSetPtr ipsdk::imaproc::glbmsr::multiSlice_kernelDensityEstimator2d ( const image::ImageConstPtr pInImg)

wrapper function for algorithm allowing to estimate probability density function of a 2d image

Note
This wrapper can be used with multi slice input images to retrieve by slice results
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ kernelDensityEstimator2d() [2/2]

IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::KDEDataSetPtr ipsdk::imaproc::glbmsr::kernelDensityEstimator2d ( const image::ImageConstPtr pInImg,
const ipUInt32  inOptKDENbSamples,
const ipsdk::imaproc::attr::KDEBandwidthPolicyConstPtr pInOptKDEBandwidthPolicy 
)

wrapper function for algorithm allowing to estimate probability density function of a 2d image

Note
This wrapper must be used with mono slice input images
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_kernelDensityEstimator2d() [2/2]

IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::PlanIndexedKDEDataSetPtr ipsdk::imaproc::glbmsr::multiSlice_kernelDensityEstimator2d ( const image::ImageConstPtr pInImg,
const ipUInt32  inOptKDENbSamples,
const ipsdk::imaproc::attr::KDEBandwidthPolicyConstPtr pInOptKDEBandwidthPolicy 
)

wrapper function for algorithm allowing to estimate probability density function of a 2d image

Note
This wrapper can be used with multi slice input images to retrieve by slice results
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure