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.
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.
- Pixels are assigned the percentage of pixels with a value of 1 inside this region. These values are expressed in the interval [0, 100].
- Pixels outside of the mask are assigned the value -1.
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 = nullptr );
This function returns outputImage.
// Function prototype. local_density_map_2d(input_binary_image: idt.ImageType, input_mask_image: idt.ImageType, kernel_size: Iterable[int] = [3, 3], output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype. public static IOLink.ImageView LocalDensityMap2d( IOLink.ImageView inputBinaryImage, IOLink.ImageView inputMaskImage, int[] kernelSize = null, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputBinaryImage |
The input binary image. | Image | Binary | nullptr | |
inputMaskImage |
The binary mask image. This image must have same dimensions and type as the main input image. | Image | Binary | nullptr | |
kernelSize |
The side size in pixels of the square kernel. | Vector2i32 | >0 | {3, 3} | |
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 |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
input_binary_image |
The input binary image. | image | Binary | None | |
input_mask_image |
The binary mask image. This image must have same dimensions and type as the main input image. | image | Binary | None | |
kernel_size |
The side size in pixels of the square kernel. | vector2i32 | >0 | [3, 3] | |
output_image |
The output image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputBinaryImage |
The input binary image. | Image | Binary | null | |
inputMaskImage |
The binary mask image. This image must have same dimensions and type as the main input image. | Image | Binary | null | |
kernelSize |
The side size in pixels of the square kernel. | Vector2i32 | >0 | {3, 3} | |
outputImage |
The output image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. | Image | null |
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();
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) local_density_map_2d_algo = imagedev.LocalDensityMap2d() local_density_map_2d_algo.input_binary_image = polystyrene_sep local_density_map_2d_algo.input_mask_image = polystyrene_sep local_density_map_2d_algo.kernel_size = [3, 3] local_density_map_2d_algo.execute() print("output_image:", str(local_density_map_2d_algo.output_image))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); LocalDensityMap2d localDensityMap2dAlgo = new LocalDensityMap2d { inputBinaryImage = polystyrene_sep, inputMaskImage = polystyrene_sep, kernelSize = new int[]{3, 3} }; localDensityMap2dAlgo.Execute(); Console.WriteLine( "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();
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) result = imagedev.local_density_map_2d(polystyrene_sep, polystyrene_sep, [3, 3]) print("output_image:", str(result))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); IOLink.ImageView result = Processing.LocalDensityMap2d( polystyrene_sep, polystyrene_sep, new int[]{3, 3} ); Console.WriteLine( "outputImage:" + result.ToString() );