[][src]Function opencv::imgproc::moments

pub fn moments(array: &dyn ToInputArray, binary_image: bool) -> Result<Moments>

Calculates all of the moments up to the third order of a polygon or rasterized shape.

The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The results are returned in the structure cv::Moments.

Parameters

  • array: Raster image (single-channel, 8-bit or floating-point 2D array) or an array ( inline formula or inline formula ) of 2D points (Point or Point2f ).
  • binaryImage: If it is true, all non-zero image pixels are treated as 1's. The parameter is used for images only.

Returns

moments.

Note: Only applicable to contour moments calculations from Python bindings: Note that the numpy type for the input array should be either np.int32 or np.float32.

See also

contourArea, arcLength

C++ default parameters

  • binary_image: false