Herror ::moments_gray_plane (
    Hobject Regions,
    Hobject Image,
    double *MRow,
    double *MCol,
    double *Alpha,
    double *Beta,
    double *Mean
)
Herror ::moments_gray_plane (
    Hobject Regions,
    Hobject Image,
    HTuple *MRow,
    HTuple *MCol,
    HTuple *Alpha,
    HTuple *Beta,
    HTuple *Mean
)
double HRegion::MomentsGrayPlane (
    const HImage &Image,
    double *MCol,
    double *Alpha,
    double *Beta,
    double *Mean
) const
HTuple HRegionArray::MomentsGrayPlane (
    const HImage &Image,
    HTuple *MCol,
    HTuple *Alpha,
    HTuple *Beta,
    HTuple *Mean
) const

Calculate gray value moments and approximation by a plane.

The operator ::moments_gray_plane calculates the gray value moments and the parameters of the approximation of the gray values by a plane. The calculation is carried out according to the following formula:

  MRow  = sum((r-r')*(Image(r,c)-Mean))/F^2
  MCol  = sum((c-c')*(Image(r,c)-Mean))/F^2
  Alpha = (MRow*F*m02-m11*MCol*F)/(m20*m02-m11^2)
  Beta  = (m20*MCol*F-MRow*F*m11)/(m20*m02-m11^2)

where F is the plane, r', c' the center, and m11, m20, and m02 the
normalized moments of Regions.
The parameters Alpha, Alpha and Mean describe a plane above the region:
  Image'(r,c) = Alpha*(r-r')+Beta*(c-c')+Mean
Thus Alpha indicates the gradient in the direction of the line axis (``down''), Beta the gradient in the direction of the column axis (to the ``right'').


Parameters

Regions (input_object)
region(-array) -> Hobject: HRegion(Array)
Regions to be checked.

Image (input_object)
image -> Hobject: HImage ( byte / real )
Corresponding gray values.

MRow (output_control)
real(-array) -> (HTuple.) double *
Mixed moments along a line.

MCol (output_control)
real(-array) -> (HTuple.) double *
Mixed moments along a column.

Alpha (output_control)
real(-array) -> (HTuple.) double *
Parameter Alpha of the approximating plane.

Beta (output_control)
real(-array) -> (HTuple.) double *
Parameter Beta of the approximating plane.

Mean (output_control)
real(-array) -> (HTuple.) double *
Mean gray value.


Result

The operator ::moments_gray_plane returns the value H_MSG_TRUE if an image with the defined gray values (byte) is entered and the parameters are correct. The behavior in case of empty input (no input images available) is set via the operator ::set_system('no_object_result',<Result>), the behavior in case of empty region is set via ::set_system('empty_region_result',<Result>). If necessary an exception handling is raised.


Possible Predecessors

::draw_region, ::gen_circle, ::gen_ellipse, ::gen_rectangle1, ::gen_rectangle2, ::threshold, ::regiongrowing


See also

::intensity, ::moments_region_2nd


References

R. Haralick, L. Shapiro; ``Computer and Robot Vision''; Addison-Wesley, 1992, pp 75-76


Module

Image filters



Copyright © 1996-2002 MVTec Software GmbH