Struct Segmentation

Source
pub struct Segmentation<D, M>
where D: Distance, M: NodeMerging,
{ /* private fields */ }
Expand description

Implementation of graph based image segmentation as described in the paper by Felzenswalb and Huttenlocher.

Implementations§

Source§

impl<D, M> Segmentation<D, M>
where D: Distance, M: NodeMerging,

Source

pub fn new(distance: D, magic: M, segment_size: usize) -> Self

Source

pub fn segment_image(&mut self, image: &Mat) -> (Mat, usize)

Build the graph based on the image, i.e. compute the weights between pixels using the underlying distance.

§Arguments
  • image - The image to oversegment.
§Returns

A tuple consisting of

  • The matrix in CV_32SC1 format containing the labels for each pixel.
  • The number of segments / components.

Trait Implementations§

Source§

impl<D, M> Debug for Segmentation<D, M>
where D: Distance + Debug, M: NodeMerging + Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<D, M> !Freeze for Segmentation<D, M>

§

impl<D, M> !RefUnwindSafe for Segmentation<D, M>

§

impl<D, M> Send for Segmentation<D, M>
where D: Send, M: Send,

§

impl<D, M> !Sync for Segmentation<D, M>

§

impl<D, M> Unpin for Segmentation<D, M>
where D: Unpin, M: Unpin,

§

impl<D, M> UnwindSafe for Segmentation<D, M>
where D: UnwindSafe, M: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.