ImageDev

LocalDensityMap2d

Measures the local density of a two-dimensional binary image within a binary mask.

Access to parameter description

This algorithm computes the density using a region formed by the intersection of a mask image and a user-defined kernel. Image borders are mirrored to ensure full kernel processing for pixels at the image boundary. The output image type is float.

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > localDensityMap2d( std::shared_ptr< iolink::ImageView > inputBinaryImage, std::shared_ptr< iolink::ImageView > inputMaskImage, iolink::Vector2i32 kernelSize, std::shared_ptr< iolink::ImageView > outputImage = NULL );

Class Syntax

Parameters

Class Name LocalDensityMap2d

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The input binary image. Image Binary nullptr
input
inputMaskImage
The binary mask image. This image must have same dimensions and type as the main input image. Image Binary nullptr
input
kernelSize
The side size in pixels of the square kernel. Vector2i32 >0 {3, 3}
output
outputImage
The output image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. Image nullptr

Object Examples

auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );

LocalDensityMap2d localDensityMap2dAlgo;
localDensityMap2dAlgo.setInputBinaryImage( polystyrene_sep );
localDensityMap2dAlgo.setInputMaskImage( polystyrene_sep );
localDensityMap2dAlgo.setKernelSize( {3, 3} );
localDensityMap2dAlgo.execute();

std::cout << "outputImage:" << localDensityMap2dAlgo.outputImage()->toString();

Function Examples

auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );

auto result = localDensityMap2d( polystyrene_sep, polystyrene_sep, {3, 3} );

std::cout << "outputImage:" << result->toString();