ImageDev

EndPoints2d

Point detector selecting end points of a two-dimensional binary image.

Access to parameter description

For an introduction:
This algorithm is a point detector that selects end points of a skeleton (that is, all object pixels having only one neighbor).
The skeleton is first detected, and then this algorithm performs a hit-or-miss transform (HMT) with the following configuration and its 7 associated rotations: $$ \begin{array}{ccc} 0 & 0 & \times\\ 0 & 1 & 0\\ 0 & 0 & 0 \end{array} $$ Where $\times$ means "don't care".

<b> Figure 1.</b> Skeleton and its end points
Figure 1. Skeleton and its end points

See also

Function Syntax

This function returns the outputBinaryImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
endPoints2d( std::shared_ptr< iolink::ImageView > inputBinaryImage,
             EndPoints2d::BorderCondition borderCondition,
             EndPoints2d::Neighborhood neighborhood,
             std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );
This function returns the outputBinaryImage output parameter.
// Function prototype.
end_points_2d( input_binary_image,
               border_condition = EndPoints2d.BorderCondition.ZERO,
               neighborhood = EndPoints2d.Neighborhood.CONNECTIVITY_8,
               output_binary_image = None )
This function returns the outputBinaryImage output parameter.
// Function prototype.
public static IOLink.ImageView
EndPoints2d( IOLink.ImageView inputBinaryImage,
             EndPoints2d.BorderCondition borderCondition = ImageDev.EndPoints2d.BorderCondition.ZERO,
             EndPoints2d.Neighborhood neighborhood = ImageDev.EndPoints2d.Neighborhood.CONNECTIVITY_8,
             IOLink.ImageView outputBinaryImage = null );

Class Syntax

Parameters

Class Name EndPoints2d

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The binary input image. Image Binary nullptr
input
borderCondition
The way to consider pixels out of image borders.
ZERO Pixels outside of the image are considered as having the value 0.
MIRROR Pixels outside of the image are considered as an extrapolation of the image pixels with a mirror border condition.
Enumeration ZERO
input
neighborhood
The 2D neighborhood configuration for performing dilations or erosions.
CONNECTIVITY_4 The structuring element is a cross.
CONNECTIVITY_8 The structuring element is a square.
Enumeration CONNECTIVITY_8
output
outputBinaryImage
The binary output image. Its size and type are forced to the same values as the input. Image nullptr

Object Examples

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

EndPoints2d endPoints2dAlgo;
endPoints2dAlgo.setInputBinaryImage( polystyrene_sep );
endPoints2dAlgo.setBorderCondition( EndPoints2d::BorderCondition::ZERO );
endPoints2dAlgo.setNeighborhood( EndPoints2d::Neighborhood::CONNECTIVITY_8 );
endPoints2dAlgo.execute();

std::cout << "outputBinaryImage:" << endPoints2dAlgo.outputBinaryImage()->toString();
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

end_points_2d_algo = imagedev.EndPoints2d()
end_points_2d_algo.input_binary_image = polystyrene_sep
end_points_2d_algo.border_condition = imagedev.EndPoints2d.ZERO
end_points_2d_algo.neighborhood = imagedev.EndPoints2d.CONNECTIVITY_8
end_points_2d_algo.execute()

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

EndPoints2d endPoints2dAlgo = new EndPoints2d
{
    inputBinaryImage = polystyrene_sep,
    borderCondition = EndPoints2d.BorderCondition.ZERO,
    neighborhood = EndPoints2d.Neighborhood.CONNECTIVITY_8
};
endPoints2dAlgo.Execute();

Console.WriteLine( "outputBinaryImage:" + endPoints2dAlgo.outputBinaryImage.ToString() );

Function Examples

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

auto result = endPoints2d( polystyrene_sep, EndPoints2d::BorderCondition::ZERO, EndPoints2d::Neighborhood::CONNECTIVITY_8 );

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

result = imagedev.end_points_2d( polystyrene_sep, imagedev.EndPoints2d.ZERO, imagedev.EndPoints2d.CONNECTIVITY_8 )

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

IOLink.ImageView result = Processing.EndPoints2d( polystyrene_sep, EndPoints2d.BorderCondition.ZERO, EndPoints2d.Neighborhood.CONNECTIVITY_8 );

Console.WriteLine( "outputBinaryImage:" + result.ToString() );