MomentsOfInertia2d
Computes the elements of the covariance matrix of a two-dimensional grayscale image.
Access to parameter description
For an introduction:
For this measurement the image calibration is ignored. The coordinates used to calculate the moments are expressed in pixels.
See also
Access to parameter description
For an introduction:
- section Image Analysis
- section Moment And Orientation
For this measurement the image calibration is ignored. The coordinates used to calculate the moments are expressed in pixels.
See also
Function Syntax
This function returns outputMeasurement.
// Function prototype
MomentsOfInertia2dMsr::Ptr momentsOfInertia2d( std::shared_ptr< iolink::ImageView > inputImage, MomentsOfInertia2dMsr::Ptr outputMeasurement = NULL );
This function returns outputMeasurement.
// Function prototype. moments_of_inertia_2d( input_image, output_measurement = None )
This function returns outputMeasurement.
// Function prototype. public static MomentsOfInertia2dMsr MomentsOfInertia2d( IOLink.ImageView inputImage, MomentsOfInertia2dMsr outputMeasurement = null );
Class Syntax
Parameters
Class Name | MomentsOfInertia2d |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputImage |
The input image. | Image | Binary, Label or Grayscale | nullptr | |
outputMeasurement |
The output measurement result. | MomentsOfInertia2dMsr | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); MomentsOfInertia2d momentsOfInertia2dAlgo; momentsOfInertia2dAlgo.setInputImage( polystyrene ); momentsOfInertia2dAlgo.execute(); std::cout << "barycenterX: " << momentsOfInertia2dAlgo.outputMeasurement()->barycenterX( 0 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) moments_of_inertia_2d_algo = imagedev.MomentsOfInertia2d() moments_of_inertia_2d_algo.input_image = polystyrene moments_of_inertia_2d_algo.execute() print( "barycenterX: ", str( moments_of_inertia_2d_algo.output_measurement.barycenter_x( 0 ) ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); MomentsOfInertia2d momentsOfInertia2dAlgo = new MomentsOfInertia2d { inputImage = polystyrene }; momentsOfInertia2dAlgo.Execute(); Console.WriteLine( "barycenterX: " + momentsOfInertia2dAlgo.outputMeasurement.barycenterX( 0 ) );
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = momentsOfInertia2d( polystyrene ); std::cout << "barycenterX: " << result->barycenterX( 0 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.moments_of_inertia_2d( polystyrene ) print( "barycenterX: ", str( result.barycenter_x( 0 ) ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); MomentsOfInertia2dMsr result = Processing.MomentsOfInertia2d( polystyrene ); Console.WriteLine( "barycenterX: " + result.barycenterX( 0 ) );