CImage:Distance
The Distance method calculates the Distance in pixel coordinate units along a line formed by 2 image points. To measure a distance in world coordinates, use the DistanceWcs method.
nDistance = CImage:Distance( x1, y1, x2, y2) |
wherex1, y1, x2, y2 are pixel coordinates and may be numbers or strings.
On success, this method returns nDistance, as a number in pixel units.
On failure, this method returns 0.
The Distance method returns a distance in pixel units. The DistanceWcs and DistanceWcsStr methods return distance measured in calibrated world coordinate units rather than pixel coordinates.
Assume an image is displayed and attached to a CImageView named V. The following script measures the distance between two points (x1,y1) and (x2,y2) when the coordinates are in pixel units:
|
-- load the image from a |
|
-- point 1 |
|
-- point 2 |
|
-- make the measurement |
CImage class, DistanceWcs, Image Coordinate System, Subpixel Coordinate Definition
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.