IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Law's 2D Texture Energy Measures

Apply Law's texture 2d filter on an image. More...

IPSDKIPLSTATS_API image::ImagePtr ipsdk::imaproc::stats::lawTexture2dImg (const image::ImageConstPtr &pInImg)
 wrapper function for Apply Law's texture 2d filter on an image More...
 
IPSDKIPLSTATS_API image::ImagePtr ipsdk::imaproc::stats::lawTexture2dImg (const image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::LawTextureKernel2dTypesConstPtr &pInKernelTypes, const ipsdk::imaproc::attr::LawTexPreProcParamsConstPtr &pInPreProcParams, const ipsdk::imaproc::attr::LawTexPostProcParamsConstPtr &pInPostProcParams)
 wrapper function for Apply Law's texture 2d filter on an image More...
 
IPSDKIPLSTATS_API void ipsdk::imaproc::stats::lawTexture2dImg (const image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::LawTextureKernel2dTypesConstPtr &pInKernelTypes, const ipsdk::imaproc::attr::LawTexPreProcParamsConstPtr &pInPreProcParams, const ipsdk::imaproc::attr::LawTexPostProcParamsConstPtr &pInPostProcParams, const image::ImagePtr &pOutRealImg, const image::ImagePtr &pOutWkImg)
 wrapper function for Apply Law's texture 2d filter on an image More...
 

Detailed Description

Apply Law's texture 2d filter on an image.

Law's texture filter generates texture features to quantify the perceived 2D textures of an image.

Law's texture 2D filter involves the following steps:

Resulting energy maps are concatenated in the output sequence image in the order specified above. Most of the time, only a subset of the 9 energy maps are interesting. The user has the possibility to specify this subset by appropriately initializing a ipsdk::imaproc::attr::LawTextureKernel2dTypes data-item and passing it as argument of lawTexture2dImg function. Then only the maps of this subset will be calculated by the algorithm and returned to the user.

Here is an example of a Law's 2D Texture Filter computation applied on a 8 bits grey level image with the default parameters:

lawTexture2dImg.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InSingleImg [Input] single image X
ipsdk::imaproc::attr::InOptLawTextureKernel2dTypes [Input Optional] Types of 2d kernels for Law's texture computation X
ipsdk::imaproc::attr::InOptLawTexPreProcParams [Input Optional] Parameters for Law's texture filter input image pre-process phasis X
ipsdk::imaproc::attr::InOptLawTexPostProcParams [Input Optional] Parameters for Law's texture filter input image post-process phasis X
ipsdk::imaproc::attr::OutRealImg [Output] image for processing operation (data contained in image buffer are reals) customOutput (_pOutRealImg, outputLawTexture2d(_pInSingleImg,_pInOptLawTextureKernel2dTypes))
ipsdk::imaproc::attr::OutWk1RealImg [Output] Temporary working image for algorithm ipsdk::imaproc::duplicateInOut (_pOutWk1RealImg, _pInSingleImg, ipsdk::image::eImageBufferType::eIBT_Real32)
ipsdk::imaproc::attr::OutOptWk1RealImg [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) X
ipsdk::imaproc::attr::OutOptWk2RealImg [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) X

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInSingleImg,_pOutWk1RealImg) && 
(ipsdk::processor::ifIsSet (_pOutOptWk1RealImg,
  ipsdk::imaproc::matchSize (_pInSingleImg,_pOutOptWk1RealImg))) && 
(ipsdk::processor::ifIsSet (_pOutOptWk2RealImg,
  ipsdk::imaproc::matchSize (_pInSingleImg,_pOutOptWk2RealImg)))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLStats as stats

Code Example

# load input image from file
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# scenario 1: compute the Law's 2D texture energy measures with default parameters:
# - pre-process phasis: subtract local mean (square neighborhood of size 15x15)
# - post-process phasis: compute energy maps using a local mean on absolute values (square neighborhood of size 15x15)
# - get all 9 energy maps
outImg = stats.lawTexture2dImg(inImg)
# extract E5E5 energy map from output image; this is the fourth image in temporal sequence
# (remember, the 9 images are ordered in sequence as follows: L5E5/E5L5, L5S5/S5L5, L5R5/R5L5, E5E5, E5S5/S5E5, E5R5/R5E5, S5S5, S5R5/R5S5, R5R5)
outImgE5E5 = PyIPSDK.extractPlan(0, 0, 3, outImg)
# scenario 2: compute the Law's 2D texture energy measures with customized parameters:
# - pre-process phasis: subtract value resulting from local gaussian smoothing with (gaussianStdDev=0.7, gaussianRatio=0.991)
# - post-process phasis: compute, for each pixel local variance on a square neighborhood of size 17x17 (17 = 2*8 + 1)
# - get the following subset of energy maps: {E5E5, R5R5}
preProcParams = PyIPSDK.createGaussianLawTexPreProcParams(0.7, PyIPSDK.createGaussianCoverage(0.991, 2))
postProcParams = PyIPSDK.createVarianceLawTexPostProcParams(8)
kernelTypes = PyIPSDK.createLawTextureKernel2dTypes()
# by default, all the flags are set to true, so reset all flags but FlagE5E5 and FlagR5R5
kernelTypes.flagL5E5_E5L5 = False
kernelTypes.flagL5S5_S5L5 = False
kernelTypes.flagL5R5_R5L5 = False
kernelTypes.flagE5S5_S5E5 = False
kernelTypes.flagE5R5_R5E5 = False
kernelTypes.flagS5S5 = False
kernelTypes.flagS5R5_R5S5 = False
outImg = stats.lawTexture2dImg(inImg, kernelTypes, preProcParams, postProcParams);
# extract E5E5 energy map from output image (this is the first image in temporal sequence)
outImgE5E5 = PyIPSDK.extractPlan(0, 0, 0, outImg)
# extract R5R5 energy map from output image (this is the second image in temporal sequence)
outImgR5R5 = PyIPSDK.extractPlan(0, 0, 0, outImg)

Example of C++ code :

Example informations

Associated library

IPSDKIPLStats

Header file

Code Example

// load input image from file
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// scenario 1: compute the Law's 2D texture energy measures with default parameters:
// - pre-process phasis: subtract local mean (square neighborhood of size 15x15)
// - post-process phasis: compute energy maps using a local mean on absolute values (square neighborhood of size 15x15)
// - get all 9 energy maps
{
ImagePtr pOutImg = stats::lawTexture2dImg(pInImg);
// extract E5E5 energy map from output image; this is the fourth image in temporal sequence
// (remember, the 9 images are ordered in sequence as follows: L5E5/E5L5, L5S5/S5L5, L5R5/R5L5, E5E5, E5S5/S5E5, E5R5/R5E5, S5S5, S5R5/R5S5, R5R5)
ImagePtr pOutImgE5E5;
image::SubImageExtractor::extractPlan(0, 0, 3, *pOutImg, pOutImgE5E5);
}
// scenario 2: compute the Law's 2D texture energy measures with customized parameters:
// - pre-process phasis: subtract value resulting from local gaussian smoothing with (gaussianStdDev=0.7, gaussianRatio=0.991)
// - post-process phasis: compute, for each pixel local variance on a square neighborhood of size 17x17 (17 = 2*8 + 1)
// - get the following subset of energy maps: {E5E5, R5R5}
{
// by default, all the flags are set to true, so reset all flags but FlagE5E5 and FlagR5R5
pKernelTypes->setValue<LawTextureKernel2dTypes::FlagL5E5_E5L5>(false);
pKernelTypes->setValue<LawTextureKernel2dTypes::FlagL5S5_S5L5>(false);
pKernelTypes->setValue<LawTextureKernel2dTypes::FlagL5R5_R5L5>(false);
pKernelTypes->setValue<LawTextureKernel2dTypes::FlagE5S5_S5E5>(false);
pKernelTypes->setValue<LawTextureKernel2dTypes::FlagE5R5_R5E5>(false);
pKernelTypes->setValue<LawTextureKernel2dTypes::FlagS5S5>(false);
pKernelTypes->setValue<LawTextureKernel2dTypes::FlagS5R5_R5S5>(false);
ImagePtr pOutImg = stats::lawTexture2dImg(pInImg, pKernelTypes, pPreProcParams, pPostProcParams);
// extract E5E5 energy map from output image (this is the first image in temporal sequence)
ImagePtr pOutImgE5E5;
image::SubImageExtractor::extractPlan(0, 0, 0, *pOutImg, pOutImgE5E5);
// extract R5R5 energy map from output image (this is the second image in temporal sequence)
ImagePtr pOutImgR5R5;
image::SubImageExtractor::extractPlan(0, 0, 0, *pOutImg, pOutImgR5R5);
}
See also
LawTexture2dImgLvl1

Function Documentation

◆ lawTexture2dImg() [1/3]

IPSDKIPLSTATS_API image::ImagePtr ipsdk::imaproc::stats::lawTexture2dImg ( const image::ImageConstPtr pInImg)

wrapper function for Apply Law's texture 2d filter on an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ lawTexture2dImg() [2/3]

IPSDKIPLSTATS_API image::ImagePtr ipsdk::imaproc::stats::lawTexture2dImg ( const image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::LawTextureKernel2dTypesConstPtr pInKernelTypes,
const ipsdk::imaproc::attr::LawTexPreProcParamsConstPtr pInPreProcParams,
const ipsdk::imaproc::attr::LawTexPostProcParamsConstPtr pInPostProcParams 
)

wrapper function for Apply Law's texture 2d filter on an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ lawTexture2dImg() [3/3]

IPSDKIPLSTATS_API void ipsdk::imaproc::stats::lawTexture2dImg ( const image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::LawTextureKernel2dTypesConstPtr pInKernelTypes,
const ipsdk::imaproc::attr::LawTexPreProcParamsConstPtr pInPreProcParams,
const ipsdk::imaproc::attr::LawTexPostProcParamsConstPtr pInPostProcParams,
const image::ImagePtr pOutRealImg,
const image::ImagePtr pOutWkImg 
)

wrapper function for Apply Law's texture 2d filter on an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure