Image Processing Toolkit User Guide > Reference J–Z > MAJOR_AXIS Function (PV-WAVE Extreme Advantage)
  

MAJOR_AXIS Function (PV-WAVE Extreme Advantage)
Computes the major axis of a region in an image.
Usage
result = MAJOR_AXIS(image, pixels)
Input Parameters
image—A 2D array containing a region.
pixels—A long array containing the element numbers of the pixels in image that compose the region.
Returned Value
result—A double scalar value that is the angle defined by the horizontal axis and the major axis through the region.
Keywords
Eigval—Specifies a variable to receive the eigenvalues of the region.
Eigvect—Specifies a variable to receive the eigenvectors of the region.
Discussion
The major axis of a region describes the direction of maximal dispersion. Specifically, the major axis of a region is determined from the eigenvectors of the covariance matrix of the pixel location array, where the pixel location array is composed of the row and column values of the region pixel locations. The eigenvector corresponding to the maximum eigenvalue of the covariance matrix is the major axis angle.
Example
; Segment the image using thresholding.
image = IMAGE_READ(!IP_Data + 'blobs.tif')
one_blob = THRESHOLD(image('pixels'), 20, 25, /Binary)
; Find the major axis of the remaining blob.
blob_pixels = WHERE(one_blob NE 0)
major = MAJOR_AXIS(one_blob, blob_pixels)
PRINT, 'Major axis angle = ', major
See Also
CENTROID,   PERIMETER

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.