ObjectCount
Computes the number of objects in a binary or label image.
Access to parameter description
For an introduction: section Image Analysis.
If the input is a binary image, it is first labeled by connected component and the maximum label value is returned as number of objects. If the input is a label image, the number of objects is equal to the maximum grey level value of the input image.
See also
See related examples
Access to parameter description
For an introduction: section Image Analysis.
If the input is a binary image, it is first labeled by connected component and the maximum label value is returned as number of objects. If the input is a label image, the number of objects is equal to the maximum grey level value of the input image.
See also
See related examples
Function Syntax
This function returns a ObjectCountOutput structure containing outputLabelImage and outputMeasurement.
// Output structure of the objectCount function. struct ObjectCountOutput { /// The label output image. std::shared_ptr< iolink::ImageView > outputLabelImage; /// The output measurement result. ObjectCountMsr::Ptr outputMeasurement; }; // Function prototype
ObjectCountOutput objectCount( std::shared_ptr< iolink::ImageView > inputObjectImage, std::shared_ptr< iolink::ImageView > outputLabelImage = NULL, ObjectCountMsr::Ptr outputMeasurement = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
inputObjectImage |
The binary or label input image. | Image | Binary or Label | nullptr |
![]() |
outputLabelImage |
The label output image. | Image | nullptr | |
![]() |
outputMeasurement |
The output measurement result. | ObjectCountMsr | nullptr |
Object Examples
auto polystyrene_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep_label.vip" ); ObjectCount objectCountAlgo; objectCountAlgo.setInputObjectImage( polystyrene_sep_label ); objectCountAlgo.execute(); std::cout << "outputLabelImage:" << objectCountAlgo.outputLabelImage()->toString(); std::cout << "count: " << objectCountAlgo.outputMeasurement()->count( 0 ) ;
Function Examples
auto polystyrene_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep_label.vip" ); auto result = objectCount( polystyrene_sep_label ); std::cout << "outputLabelImage:" << result.outputLabelImage->toString(); std::cout << "count: " << result.outputMeasurement->count( 0 ) ;