Struct ImagePyramid

Source
pub struct ImagePyramid {
    pub levels: Vec<DynamicImage>,
    pub params: ImagePyramidParams,
}
Expand description

A computed image pyramid and its associated metadata.

Image pyramids consist of multiple, successively smaller-scale versions of an original image. These are called the levels (sometimes called octaves) of the image pyramid.

Closely related to a traditional Gaussian image pyramid is a mipmap, which is a specific application of the more general image pyramid concept. A mipmap is essentially a way of storing a scale=0.5 lowpass image pyramid such that an appropriate octave can be sampled by a graphics renderer, for the purpose of avoiding anti-aliasing.

Fields§

§levels: Vec<DynamicImage>

The ordered levels of the pyramid. Index N refers to pyramid level N. Depending on the scale factor S in params, and image dimensions (W, H), there will be ceil(log_{1/S}(min(W, H))) levels.

For example, a (800, 600) image with scale factor S=0.5 will have ceil(log_2(600)) levels, which comes out to 10. Similarly, a (640, 480) image would have (ceil(log_2(480)) (9) levels.

§params: ImagePyramidParams

A copy of the parameters used to compute the levels in this pyramid.

Implementations§

Source§

impl ImagePyramid

Source

pub fn create( image: &DynamicImage, params: Option<&ImagePyramidParams>, ) -> Result<Self, ImagePyramidError>

Create a new image pyramid for the given image, using the optionally provided parameters.

If no parameters are passed, the default parameters will be used.

§Errors

See CanComputePyramid::compute_image_pyramid for errors that may be raised

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.