AutoIntensityClassification
Classifies all pixels of a grayscale image using the k-means clustering method.
Access to parameter description
As 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
As 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 outputLabelImage.
// 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 );
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();
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = autoIntensityClassification( foam, 2, 100 ); std::cout << "outputLabelImage:" << result->toString();