Operators

# moments_gray_plane (Operator)

## Name

moments_gray_plane — Calculate gray value moments and approximation by a plane.

## Signature

moments_gray_plane(Regions, Image : : : MRow, MCol, Alpha, Beta, Mean)

## Description

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, Beta 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”).

## Attention

Note that the operator moments_gray_plane only considers the given Regions and ignores any previously set domain of the input image Image.

## Parallelization

• Multithreading type: reentrant (runs in parallel with non-exclusive operators).
• Automatically parallelized on tuple level.

## Parameters

Regions (input_object)  region(-array) object

Regions to be checked.

Image (input_object)  singlechannelimage object (byte / direction / cyclic / uint2 / real)

Corresponding gray values.

MRow (output_control)  real(-array) (real)

Mixed moments along a line.

MCol (output_control)  real(-array) (real)

Mixed moments along a column.

Alpha (output_control)  real(-array) (real)

Parameter Alpha of the approximating plane.

Beta (output_control)  real(-array) (real)

Parameter Beta of the approximating plane.

Mean (output_control)  real(-array) (real)

Mean gray value.

## Result

The operator moments_gray_plane 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.