Skip to content

moments_gray_planemoments_gray_planeMomentsGrayPlaneMomentsGrayPlanemoments_gray_planemoments_gray_planeπŸ”—

Short descriptionπŸ”—

moments_gray_planemoments_gray_planeMomentsGrayPlaneMomentsGrayPlanemoments_gray_planemoments_gray_plane β€” Calculate gray value moments and approximation by a plane.

SignatureπŸ”—

moments_gray_plane( region Regions, image Image, out real MRow, out real MCol, out real Alpha, out real Beta, out real Mean )moments_gray_plane( Regions, Image : : : MRow, MCol, Alpha, Beta, Mean )void MomentsGrayPlane( const HObject& Regions, const HObject& Image, HTuple* MRow, HTuple* MCol, HTuple* Alpha, HTuple* Beta, HTuple* Mean )static void HOperatorSet.MomentsGrayPlane( HObject regions, HObject image, out HTuple MRow, out HTuple MCol, out HTuple alpha, out HTuple beta, out HTuple mean )def moments_gray_plane( regions: HObject, image: HObject ) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

def moments_gray_plane_s( regions: HObject, image: HObject ) -> Tuple[float, float, float, float, float]Herror moments_gray_plane( const Hobject Regions, const Hobject Image, double* MRow, double* MCol, double* Alpha, double* Beta, double* Mean )

Herror T_moments_gray_plane( const Hobject Regions, const Hobject Image, Htuple* MRow, Htuple* MCol, Htuple* Alpha, Htuple* Beta, Htuple* Mean )

void HImage::MomentsGrayPlane( const HRegion& Regions, HTuple* MRow, HTuple* MCol, HTuple* Alpha, HTuple* Beta, HTuple* Mean ) const

void HImage::MomentsGrayPlane( const HRegion& Regions, double* MRow, double* MCol, double* Alpha, double* Beta, double* Mean ) const

void HRegion::MomentsGrayPlane( const HImage& Image, HTuple* MRow, HTuple* MCol, HTuple* Alpha, HTuple* Beta, HTuple* Mean ) const

void HRegion::MomentsGrayPlane( const HImage& Image, double* MRow, double* MCol, double* Alpha, double* Beta, double* Mean ) const

void HImage.MomentsGrayPlane( HRegion regions, out HTuple MRow, out HTuple MCol, out HTuple alpha, out HTuple beta, out HTuple mean )

void HImage.MomentsGrayPlane( HRegion regions, out double MRow, out double MCol, out double alpha, out double beta, out double mean )

void HRegion.MomentsGrayPlane( HImage image, out HTuple MRow, out HTuple MCol, out HTuple alpha, out HTuple beta, out HTuple mean )

void HRegion.MomentsGrayPlane( HImage image, out double MRow, out double MCol, out double alpha, out double beta, out double mean )

DescriptionπŸ”—

The operator moments_gray_planeMomentsGrayPlane 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:

\[\begin{eqnarray*} \textrm{MRow} &=& \frac{1}{F^2} \sum_{(r,c) \in \textrm{Regions}} {(r - \overline{r})(\textrm{Image}(r,c) - \textrm{Mean})}\\ \textrm{MCol} &=& \frac{1}{F^2} \sum_{(r,c) \in \textrm{Regions}} {(c - \overline{c})(\textrm{Image}(r,c) - \textrm{Mean})}\\ \textrm{Alpha} &=& \frac{\textrm{MRow} F m_{02} - m_{11} \textrm{MCol}} F {m_{20}m_{02}-m_{11}^2}\\ \textrm{Beta} &=& \frac{m_{20}\textrm{MCol} F - \textrm{MRow} F m_{11}} {m_{20}m_{02}-m_{11}^2} \end{eqnarray*}\]

where \(F\) is the plane, \(\overline{r}\), \(\overline{c}\) the center, and \(m_{11}\), \(m_{20}\), and \(m_{02}\) the scaled moments of Regionsregionsregions.

The parameters Alphaalphaalpha, Betabetabeta and Meanmeanmean describe a plane above the region:

\[\begin{eqnarray*} \textrm{Image}'(r,c) = \textrm{Alpha}(r-\overline{r}) + \textrm{Beta}(c-\overline{c}) + \textrm{Mean} \end{eqnarray*}\]

Thus Alphaalphaalpha indicates the gradient in the direction of the line axis (β€œdown”), Betabetabeta the gradient in the direction of the column axis (to the β€œright”).

AttentionπŸ”—

Note that the operator moments_gray_planeMomentsGrayPlane only considers the given Regionsregionsregions and ignores any previously set domain of the input image Imageimageimage.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

ParametersπŸ”—

Regionsregionsregions (input_object) region(-array) β†’ objectobjectHObjectHRegionHObjectHobject

Regions to be checked.

Imageimageimage (input_object) singlechannelimage β†’ object (byte / direction / cyclic / uint2 / real)object (byte / direction / cyclic / uint2 / real)HObject (byte / direction / cyclic / uint2 / real)HImage (byte / direction / cyclic / uint2 / real)HObject (byte / direction / cyclic / uint2 / real)Hobject (byte / direction / cyclic / uint2 / real)

Corresponding gray values.

MRowMRowmrow (output_control) real(-array) β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Mixed moments along a line.

MColMColmcol (output_control) real(-array) β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Mixed moments along a column.

Alphaalphaalpha (output_control) real(-array) β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Parameter Alpha of the approximating plane.

Betabetabeta (output_control) real(-array) β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Parameter Beta of the approximating plane.

Meanmeanmean (output_control) real(-array) β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Mean gray value.

ResultπŸ”—

The operator moments_gray_planeMomentsGrayPlane returns the value 2 (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 is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

draw_regionDrawRegion, gen_circleGenCircle, gen_ellipseGenEllipse, gen_rectangle1GenRectangle1, gen_rectangle2GenRectangle2, thresholdThreshold, regiongrowingRegiongrowing

See also

intensityIntensity, moments_region_2ndMomentsRegion2nd

ReferencesπŸ”—

R. Haralick, L. Shapiro; β€œComputer and Robot Vision”; Addison-Wesley, 1992, pp 75-76

ModuleπŸ”—

Foundation