CCentroid Class


The CCentroid class encapsulates functionality for computing accurate centroid coordinates in an image. The centroid position is a refined coordinate based upon higher order moments of the pixel value distribution. This class provides methods for calculating the centroid position and for working with control parameters. The pixel coordinates may be converted to world coordinates using one of the CImage class methods such as XyToWcs.

Usage

Construction

Object = new_centroid()

Object = CCentroid:new()

Destruction

Object:delete()

Properties

The properties in the table below may be accessed directly. However, you can also access them using the provided Get... and Set... methods.

radiusX

The pixel radius for computing the centroid position in the x direction.

radiusY

The pixel radius for computing the centroid position in the y direction.

trackX

The pixel radius for tracking the peak or valley in the x direction from the initial position to the centroid position.

trackY

The pixel radius for tracking the peak or valley in the y direction from the initial position to the centroid position.

bPositive

True if centroids are computed for peaks, or false if computed for valleys.

Creation - Non-class Functions

This function is normally used to create a new CCentroid object as an alternative to the class-based new method.

new_centroid

Creates a new instance of a CCentroid object.

Construct and Destruction - Class Methods

new

Creates a new instance of a CCentroid object. Various constructors are available

delete

Deletes the instance of the CCentroid object.

Data Member Access

GetSign

Returns a boolean flag for the direction used to compute centroid positions. The value true means that centroid are computed for peaks, rather than for valleys.

GetSample

Returns the centroid sample radius in x and y directions.

GetTracking

Sets the centroid tracking radius in x and y directions.

SetSign

Sets the centroid calculation to use peaks (true) or valleys (false).

SetSample

Sets the sample radius in x and y directions to the specified number of pixels.

SetTracking

Sets the tracking radius in x and y directions to the specified number of pixels.

Operations

Calc

Calculates the centroid position for the image near starting coordinate x,y.

X

Returns the computed x coordinate of the centroid position.

Y

Returns the computed y coordinate of the centroid position.

Related Topics

Script Classes,, Image Coordinate System, Subpixel Coordinate Definition


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.