ImageDev

EulerNumber2d

Measures the Euler characteristic, which is a topological invariant indicator, from objects of a two-dimensional binary image.

Access to parameter description

For an introduction: section Image Analysis.

The Euler number, or Euler-Poincar characteristic $\chi$, or connectivity number, is a topological parameter which describes the structure of an object, regardless of its specific geometric shape. This indicator is topologically invariant, which means it remains unchanged by elastic transformations of the studied structure. Other topological parameters exist, such as the number of branches or of triple points in a skeleton, the hierarchical degree of a tree-like skeleton or the number of neighbours for a cell in a skeleton by zone of influence.

The Euler number is correlated with the "redundant connectivity", which can be defined as the maximal number of branches of a structure that may be cut without splitting it into several unconnected parts.

In 2D, the Euler number is related to the number of connected components $C$, and to the number of holes $H$ in each of these components. The 2D Euler number is defined as $\chi=C-H$.

This algorithm computes the Euler number as the sum of measurements in local neighborhoods, considering the 8-connectivity. In the continuous case, this measurement is null almost everywhere, except on contours.

In the 2D discrete case, this local measurement is derived from the Euler formula for graph $$\chi=C-H=V+F-E$$ where $C$ is the number of connected components, $H$ the number of holes, $V$ the number of vertices, $F$ the number of elementary faces, and $E$ the number of edges.

On a square grid, the Euler number can be computed by searching specific configurations around each point, as follows $$ \chi=N \begin{bmatrix} 1 & 0\\ 0 & 0 \end{bmatrix} -N \begin{bmatrix} \times & 1\\ 1 & 0 \end{bmatrix} $$ where $N[SE]$ represents the number of occurrences of the structuring element $[SE]$ and $\times$ means "do not care".

The number of objects or connected components is straightforward to compute with the Labeling2d algorithm. The number of holes can be deduced by subtracting the Euler number from the number of connected components.

References See also

Function Syntax

This function returns outputMeasurement.
// Function prototype
Euler2dMsr::Ptr eulerNumber2d( std::shared_ptr< iolink::ImageView > inputBinaryImage, Euler2dMsr::Ptr outputMeasurement = nullptr );
This function returns outputMeasurement.
// Function prototype.
euler_number_2d(input_binary_image: idt.ImageType,
                output_measurement: Union[Any, None] = None) -> Euler2dMsr
This function returns outputMeasurement.
// Function prototype.
public static Euler2dMsr
EulerNumber2d( IOLink.ImageView inputBinaryImage, Euler2dMsr outputMeasurement = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The 2D binary input image. Image Binary nullptr
output
outputMeasurement
The output measurement result. Euler2dMsr nullptr
Parameter Name Description Type Supported Values Default Value
input
input_binary_image
The 2D binary input image. image Binary None
output
output_measurement
The output measurement result. Euler2dMsr None
Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The 2D binary input image. Image Binary null
output
outputMeasurement
The output measurement result. Euler2dMsr null

Object Examples

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

EulerNumber2d eulerNumber2dAlgo;
eulerNumber2dAlgo.setInputBinaryImage( polystyrene_sep );
eulerNumber2dAlgo.execute();

std::cout << "eulerNumber: " << eulerNumber2dAlgo.outputMeasurement()->eulerNumber( 0 ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

euler_number_2d_algo = imagedev.EulerNumber2d()
euler_number_2d_algo.input_binary_image = polystyrene_sep
euler_number_2d_algo.execute()

print("eulerNumber: ", str(euler_number_2d_algo.output_measurement.euler_number(0)))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

EulerNumber2d eulerNumber2dAlgo = new EulerNumber2d
{
    inputBinaryImage = polystyrene_sep
};
eulerNumber2dAlgo.Execute();

Console.WriteLine( "eulerNumber: " + eulerNumber2dAlgo.outputMeasurement.eulerNumber( 0 ) );

Function Examples

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

auto result = eulerNumber2d( polystyrene_sep );

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

result = imagedev.euler_number_2d(polystyrene_sep)

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

Euler2dMsr result = Processing.EulerNumber2d( polystyrene_sep );

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