ImageDev

Eccentricity2d

Computes a shape factor of a binary two-dimensional image.

Access to parameter description

For an introduction: The eccentricty is a classical elliptic parameter used for characterizing the shape of binarized objects. The eccentricity of an ellipse, usually denoted by $e$, is the ratio of the distance between its two foci to the length of its major axis.

The eccentricity is necessarily between 0 and 1; it is zero if and only if $a=b$, in which case the ellipse is a circle.
As the eccentricity tends to 1, the ellipse gets a more elongated shape and tends either towards a line segment (see below) or a parabola, and the ratio $a/b$ tends to infinity: $$e=\sqrt{1-\frac{b^2}{a^2}}$$
See also

Function Syntax

This function returns the outputMeasurement output parameter.
// Function prototype.
Eccentricity2dMsr::Ptr
eccentricity2d( std::shared_ptr< iolink::ImageView > inputBinaryImage, Eccentricity2dMsr::Ptr outputMeasurement = NULL );
This function returns the outputMeasurement output parameter.
// Function prototype.
eccentricity_2d( input_binary_image, output_measurement = None )
This function returns the outputMeasurement output parameter.
// Function prototype.
public static Eccentricity2dMsr
Eccentricity2d( IOLink.ImageView inputBinaryImage, Eccentricity2dMsr outputMeasurement = null );

Class Syntax

Parameters

Class Name Eccentricity2d

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The input binary image. Image Binary nullptr
output
outputMeasurement
The output measurement result. Eccentricity2dMsr nullptr

Object Examples

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

Eccentricity2d eccentricity2dAlgo;
eccentricity2dAlgo.setInputBinaryImage( polystyrene_sep );
eccentricity2dAlgo.execute();

std::cout << "eccentricity: " << eccentricity2dAlgo.outputMeasurement()->eccentricity( ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

eccentricity_2d_algo = imagedev.Eccentricity2d()
eccentricity_2d_algo.input_binary_image = polystyrene_sep
eccentricity_2d_algo.execute()

print( "eccentricity: ", str( eccentricity_2d_algo.output_measurement.eccentricity( ) ) )
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

Eccentricity2d eccentricity2dAlgo = new Eccentricity2d
{
    inputBinaryImage = polystyrene_sep
};
eccentricity2dAlgo.Execute();

Console.WriteLine( "eccentricity: " + eccentricity2dAlgo.outputMeasurement.eccentricity( ) );

Function Examples

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

auto result = eccentricity2d( polystyrene_sep );

std::cout << "eccentricity: " << result->eccentricity( ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

result = imagedev.eccentricity_2d( polystyrene_sep )

print( "eccentricity: ", str( result.eccentricity( ) )  )
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

Eccentricity2dMsr result = Processing.Eccentricity2d( polystyrene_sep );

Console.WriteLine(  "eccentricity: " + result.eccentricity( )  );