Skip to content

area_center_grayAreaCenterGrayAreaCenterGrayarea_center_grayarea_center_gray🔗

Short description🔗

area_center_grayAreaCenterGrayAreaCenterGrayarea_center_grayarea_center_gray — Compute the area and center of gravity of a region in a gray value image.

Signature🔗

area_center_gray( region Regions, image Image, out real Area, out point.y Row, out point.x Column )void AreaCenterGray( const HObject& Regions, const HObject& Image, HTuple* Area, HTuple* Row, HTuple* Column )static void HOperatorSet.AreaCenterGray( HObject regions, HObject image, out HTuple area, out HTuple row, out HTuple column )def area_center_gray( regions: HObject, image: HObject ) -> Tuple[Sequence[float], Sequence[float], Sequence[float]]

def area_center_gray_s( regions: HObject, image: HObject ) -> Tuple[float, float, float]Herror area_center_gray( const Hobject Regions, const Hobject Image, double* Area, double* Row, double* Column )

Herror T_area_center_gray( const Hobject Regions, const Hobject Image, Htuple* Area, Htuple* Row, Htuple* Column )

HTuple HImage::AreaCenterGray( const HRegion& Regions, HTuple* Row, HTuple* Column ) const

double HImage::AreaCenterGray( const HRegion& Regions, double* Row, double* Column ) const

HTuple HRegion::AreaCenterGray( const HImage& Image, HTuple* Row, HTuple* Column ) const

double HRegion::AreaCenterGray( const HImage& Image, double* Row, double* Column ) const

HTuple HImage.AreaCenterGray( HRegion regions, out HTuple row, out HTuple column )

double HImage.AreaCenterGray( HRegion regions, out double row, out double column )

HTuple HRegion.AreaCenterGray( HImage image, out HTuple row, out HTuple column )

double HRegion.AreaCenterGray( HImage image, out double row, out double column )

Description🔗

area_center_grayAreaCenterGray computes the area and center of gravity of the regions Regionsregionsregions that have gray values which are defined by the image Imageimageimage. This operator is similar to area_centerAreaCenter, but in contrast to that operator, the gray values of the image are taken into account while computing the area and center of gravity.

The area \(A\) of a region \(R\) in the image with the gray values \(g(r,c)\) is defined as

\[\begin{eqnarray*} A = \sum_{(r,c) \in R} g(r,c) . \end{eqnarray*}\]

This means that the area is defined by the volume of the gray value function \(g(r,c)\). The center of gravity is defined by the first two normalized moments of the gray values \(g(r,c)\), i.e., by \((m_{1,0},m_{0,1})\), where

\[\begin{eqnarray*} m_{p,q} = \frac{1}{A} \sum_{(r,c) \in R} r^p c^q g(r,c) . \end{eqnarray*}\]

Note, that in the case where the Areaareaarea is zero the row and column coordinates of the center of gravity are also set to zero.

Attention🔗

Note that the operator area_center_grayAreaCenterGray only considers the given Regionsregionsregions and ignores any previously set domain of the input image Imageimageimage. area_center_grayAreaCenterGray can be executed on OpenCL devices if the device supports the cl_khr_fp64 and cl_khr_int64_base_atomics OpenCL extensions.

Execution information🔗

Execution information
  • Supports OpenCL compute devices.

  • 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) → objectHObjectHRegionHObjectHobject

Region(s) to be examined.

Imageimageimage (input_object) singlechannelimage → object (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / real*)HObject (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / real*)HImage (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / real*)HObject (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / real*)Hobject (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / real*) *allowed for compute devices

Gray value image.

Areaareaarea (output_control) real(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Gray value volume of the region.

Rowrowrow (output_control) point.y(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinate of the gray value center of gravity.

Columncolumncolumn (output_control) point.x(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinate of the gray value center of gravity.

Result🔗

area_center_grayAreaCenterGray returns 2 (H_MSG_TRUE) if all parameters are correct and no error occurs during execution. If the input is empty the behavior can be set via set_system(::'no_object_result',<Result>:). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, regiongrowingRegiongrowing, connectionConnection

Alternatives

area_centerAreaCenter

See also

area_center_xldAreaCenterXld, elliptic_axis_grayEllipticAxisGray

Module🔗

Foundation