Struct opencv::core::Moments

source ·
#[repr(C)]
pub struct Moments {
Show 24 fields pub m00: f64, pub m10: f64, pub m01: f64, pub m20: f64, pub m11: f64, pub m02: f64, pub m30: f64, pub m21: f64, pub m12: f64, pub m03: f64, pub mu20: f64, pub mu11: f64, pub mu02: f64, pub mu30: f64, pub mu21: f64, pub mu12: f64, pub mu03: f64, pub nu20: f64, pub nu11: f64, pub nu02: f64, pub nu30: f64, pub nu21: f64, pub nu12: f64, pub nu03: f64,
}
Expand description

struct returned by cv::moments

The spatial moments inline formula are computed as:

block formula

The central moments inline formula are computed as:

block formula

where inline formula is the mass center:

block formula

The normalized central moments inline formula are computed as:

block formula

Note: inline formula, inline formula inline formula , hence the values are not stored.

The moments of a contour are defined in the same way but computed using the Green’s formula (see http://en.wikipedia.org/wiki/Green_theorem). So, due to a limited raster resolution, the moments computed for a contour are slightly different from the moments computed for the same rasterized contour.

Note: Since the contour moments are computed using Green formula, you may get seemingly odd results for contours with self-intersections, e.g. a zero area (m00) for butterfly-shaped contours.

Fields§

§m00: f64

spatial moments

§m10: f64

spatial moments

§m01: f64

spatial moments

§m20: f64

spatial moments

§m11: f64

spatial moments

§m02: f64

spatial moments

§m30: f64

spatial moments

§m21: f64

spatial moments

§m12: f64

spatial moments

§m03: f64

spatial moments

§mu20: f64

central moments

§mu11: f64

central moments

§mu02: f64

central moments

§mu30: f64

central moments

§mu21: f64

central moments

§mu12: f64

central moments

§mu03: f64

central moments

§nu20: f64

central normalized moments

§nu11: f64

central normalized moments

§nu02: f64

central normalized moments

§nu30: f64

central normalized moments

§nu21: f64

central normalized moments

§nu12: f64

central normalized moments

§nu03: f64

central normalized moments

Implementations§

source§

impl Moments

source

pub fn default() -> Result<Moments>

the default constructor

source

pub fn new( m00: f64, m10: f64, m01: f64, m20: f64, m11: f64, m02: f64, m30: f64, m21: f64, m12: f64, m03: f64 ) -> Result<Moments>

the full constructor

Trait Implementations§

source§

impl Clone for Moments

source§

fn clone(&self) -> Moments

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Moments

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Moments

source§

fn eq(&self, other: &Moments) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Moments

source§

impl StructuralPartialEq for Moments

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.