ImageDev

IntensityIntegral2d

Computes the sum of all pixel intensities of a two-dimensional image.

Access to parameter description

For an introduction: section Image Analysis.

In the continuous case, the 2D intensity integral of an object $X$ is defined as: $$ V(X)=\int_{R^2}I(x,y)dxdy $$
In the discrete case, intensity integral is approximated by the sum of the pixel intensities in X: $$ V(X)=\sum_{i,j}I(x_i,y_j) $$ where $I(x_i,y_j)$ = the intensity of pixel of coordinates $x_i,y_j$

On a grayscale image, this algorithm computes the sum of gray values in the image.
This algorithm takes into account the pixel size given by the input image calibration property. Each pixel intensity is multiplied by the pixels size in the X and Y directions before to be added to the result.

On a binary image it amounts to compute a 2D area.

See also

Function Syntax

This function returns the outputMeasurement output parameter.
// Function prototype.
IntensityIntegral2dMsr::Ptr
intensityIntegral2d( std::shared_ptr< iolink::ImageView > inputImage, IntensityIntegral2dMsr::Ptr outputMeasurement = NULL );
This function returns the outputMeasurement output parameter.
// Function prototype.
intensity_integral_2d( input_image, output_measurement = None )
This function returns the outputMeasurement output parameter.
// Function prototype.
public static IntensityIntegral2dMsr
IntensityIntegral2d( IOLink.ImageView inputImage, IntensityIntegral2dMsr outputMeasurement = null );

Class Syntax

Parameters

Class Name IntensityIntegral2d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The 2D binary or grayscale input image. Image Binary, Label, Grayscale or Multispectral nullptr
output
outputMeasurement
The output measurement results. IntensityIntegral2dMsr nullptr

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

IntensityIntegral2d intensityIntegral2dAlgo;
intensityIntegral2dAlgo.setInputImage( polystyrene );
intensityIntegral2dAlgo.execute();

std::cout << "intensityIntegral: " << intensityIntegral2dAlgo.outputMeasurement()->intensityIntegral( 0 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

intensity_integral_2d_algo = imagedev.IntensityIntegral2d()
intensity_integral_2d_algo.input_image = polystyrene
intensity_integral_2d_algo.execute()

print( 
print("intensityIntegral: ", intensity_integral_2d_algo.output_measurement.intensity_integral( 0 ) ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IntensityIntegral2d intensityIntegral2dAlgo = new IntensityIntegral2d
{
    inputImage = polystyrene
};
intensityIntegral2dAlgo.Execute();

Console.WriteLine( "intensityIntegral: " + intensityIntegral2dAlgo.outputMeasurement.intensityIntegral( 0 ) );

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = intensityIntegral2d( polystyrene );

std::cout << "intensityIntegral: " << result->intensityIntegral( 0 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

result = imagedev.intensity_integral_2d( polystyrene )

print( "intensityIntegral: ", result.intensity_integral( 0 ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IntensityIntegral2dMsr result = Processing.IntensityIntegral2d( polystyrene );

Console.WriteLine(  "intensityIntegral: " + result.intensityIntegral( 0 )  );