AutoIntensityClassification
            Classifies all pixels of a grayscale image using the k-means clustering method.
Access to parameter description
For an introduction:
        
Let $S$ denote the set of image intensities. The input image can be a color image, so $S$ is a set of vectors in which each element corresponds to an image channel.
        
$K$ is the number of classes to obtain, which is the main parameter of the algorithm. The size of the subset $S'$ is also a parameter of the algorithm, given as a percentage of the input data.
        
Reference:
S. P. Lloyd, "Least square quantization in PCM", IEEE Transactions on Information Theory, vol. 28, no 2, pp. 129-137, 1982.
        
See also
		Access to parameter description
For an introduction:
- section Image Segmentation
 - section Unsupervised Classification
 
Let $S$ denote the set of image intensities. The input image can be a color image, so $S$ is a set of vectors in which each element corresponds to an image channel.
- $K$ vectors are randomly created to initialize the centers of the classes.
 - A subset $S'$ of $S$ is randomly selected to reduce the computation time.
 - The following process is iterated until minimization of the sum of the squared Euclidean distance of each vector in the cluster to its center (Within-Cluster Sum of Squares or WCSS):
 - All vectors of $S'$ are assigned to a class, according to the closest class centers, using the squared Euclidean distance.
 - The class centers are updated.
 - All vectors of the initial set $S$ are finally classified in the $K$ clusters to obtain the result classification.
 
$K$ is the number of classes to obtain, which is the main parameter of the algorithm. The size of the subset $S'$ is also a parameter of the algorithm, given as a percentage of the input data.
Reference:
S. P. Lloyd, "Least square quantization in PCM", IEEE Transactions on Information Theory, vol. 28, no 2, pp. 129-137, 1982.
See also
Function Syntax
This function returns the outputLabelImage output parameter.
                        
                    
// Function prototype.
std::shared_ptr< iolink::ImageView >
autoIntensityClassification( std::shared_ptr< iolink::ImageView > inputImage,
                             int32_t classNumber,
                             int32_t dataPercentage,
                             std::shared_ptr< iolink::ImageView > outputLabelImage = NULL );
                    
This function returns the outputLabelImage output parameter.
                        
                    
// Function prototype.
auto_intensity_classification( input_image,
                               class_number = 2,
                               data_percentage = 100,
                               output_label_image = None )
                    
This function returns the outputLabelImage output parameter.
                        
                
// Function prototype.
public static IOLink.ImageView
AutoIntensityClassification( IOLink.ImageView inputImage,
                             Int32 classNumber = 2,
                             Int32 dataPercentage = 100,
                             IOLink.ImageView outputLabelImage = null );
                    Class Syntax
Parameters
| Class Name | AutoIntensityClassification | 
|---|
| Parameter Name | Description | Type | Supported Values | Default Value | |
|---|---|---|---|---|---|
![]()  | 
  inputImage    | 
 The input image. | Image | Grayscale or Multispectral | nullptr | 
![]()  | 
  classNumber    | 
 The number of classes to detect (the label number of the output). | Int32 | >=0 | 2 | 
![]()  | 
  dataPercentage    | 
 The data percentage used for pre-computing the classification. | Int32 | [1, 100] | 100 | 
![]()  | 
  outputLabelImage    | 
 The output label image where a one label represents one class. | Image | nullptr | |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); AutoIntensityClassification autoIntensityClassificationAlgo; autoIntensityClassificationAlgo.setInputImage( foam ); autoIntensityClassificationAlgo.setClassNumber( 2 ); autoIntensityClassificationAlgo.setDataPercentage( 100 ); autoIntensityClassificationAlgo.execute(); std::cout << "outputLabelImage:" << autoIntensityClassificationAlgo.outputLabelImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))
auto_intensity_classification_algo = imagedev.AutoIntensityClassification()
auto_intensity_classification_algo.input_image = foam
auto_intensity_classification_algo.class_number = 2
auto_intensity_classification_algo.data_percentage = 100
auto_intensity_classification_algo.execute()
print( "output_label_image:", str( auto_intensity_classification_algo.output_label_image ) );
            
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );
AutoIntensityClassification autoIntensityClassificationAlgo = new AutoIntensityClassification
{
    inputImage = foam,
    classNumber = 2,
    dataPercentage = 100
};
autoIntensityClassificationAlgo.Execute();
Console.WriteLine( "outputLabelImage:" + autoIntensityClassificationAlgo.outputLabelImage.ToString() );
            Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = autoIntensityClassification( foam, 2, 100 ); std::cout << "outputLabelImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))
result = imagedev.auto_intensity_classification( foam, 2, 100 )
print( "output_label_image:", str( result ) );
            ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.AutoIntensityClassification( foam, 2, 100 ); Console.WriteLine( "outputLabelImage:" + result.ToString() );

