Area2d
Computes the area of foreground pixels in a two-dimensional binary image.
Access to parameter description
For an introduction: section Image Analysis.
In the continuous, or theoretical, case, area is defined as: $$A(x)=\int_{R^2}dxdy$$ In the discrete, or actual, case, area is approximated by the number of pixels in X: $$A(x)=\sum_{i,j}g(x_i,y_j)$$ where:
$$\begin{array}{l} g(x_i,y_j)=1 ~ \mbox{if the pixel lies within the object X}\\ g(x_i,y_j)=0 ~ \mbox{otherwise}\end{array}$$ The area measurement can be weighted by a size factor which characterizes the area of a single pixel. This information is given by the calibration spacing of the input image. If this image peoperty is correctly filled, the measurement is physically homogeneous to the area.
This algorithm can be applied on a binary image and returns:
See related example
Access to parameter description
For an introduction: section Image Analysis.
In the continuous, or theoretical, case, area is defined as: $$A(x)=\int_{R^2}dxdy$$ In the discrete, or actual, case, area is approximated by the number of pixels in X: $$A(x)=\sum_{i,j}g(x_i,y_j)$$ where:
$$\begin{array}{l} g(x_i,y_j)=1 ~ \mbox{if the pixel lies within the object X}\\ g(x_i,y_j)=0 ~ \mbox{otherwise}\end{array}$$ The area measurement can be weighted by a size factor which characterizes the area of a single pixel. This information is given by the calibration spacing of the input image. If this image peoperty is correctly filled, the measurement is physically homogeneous to the area.
This algorithm can be applied on a binary image and returns:
- The number of non-zero pixels in the image.
- The physical area taking into account the pixel size from input calibration.
- The area fraction between non-zero pixels and the total number of pixels in the input image.
See related example
Function Syntax
This function returns outputMeasurement.
// Function prototype
Area2dMsr::Ptr area2d( std::shared_ptr< iolink::ImageView > inputBinaryImage, Area2dMsr::Ptr outputMeasurement = nullptr );
This function returns outputMeasurement.
// Function prototype. area_2d(input_binary_image: idt.ImageType, output_measurement: Union[Any, None] = None) -> Area2dMsr
This function returns outputMeasurement.
// Function prototype. public static Area2dMsr Area2d( IOLink.ImageView inputBinaryImage, Area2dMsr outputMeasurement = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputBinaryImage |
The 2D binary input image. | Image | Binary | nullptr | |
outputMeasurement |
The output measurement results. | Area2dMsr | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
input_binary_image |
The 2D binary input image. | image | Binary | None | |
output_measurement |
The output measurement results. | Area2dMsr | None |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputBinaryImage |
The 2D binary input image. | Image | Binary | null | |
outputMeasurement |
The output measurement results. | Area2dMsr | null |
Object Examples
auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" ); Area2d area2dAlgo; area2dAlgo.setInputBinaryImage( polystyrene_sep ); area2dAlgo.execute(); std::cout << "area: " << area2dAlgo.outputMeasurement()->area( 0 ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) area_2d_algo = imagedev.Area2d() area_2d_algo.input_binary_image = polystyrene_sep area_2d_algo.execute() print("area: ", str(area_2d_algo.output_measurement.area(0)))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); Area2d area2dAlgo = new Area2d { inputBinaryImage = polystyrene_sep }; area2dAlgo.Execute(); Console.WriteLine( "area: " + area2dAlgo.outputMeasurement.area( 0 ) );
Function Examples
auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" ); auto result = area2d( polystyrene_sep ); std::cout << "area: " << result->area( 0 ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) result = imagedev.area_2d(polystyrene_sep) print("area: ", str(result.area(0)))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); Area2dMsr result = Processing.Area2d( polystyrene_sep ); Console.WriteLine( "area: " + result.area( 0 ) );