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
impl ImagePyramid
Sourcepub fn create(
image: &DynamicImage,
params: Option<&ImagePyramidParams>,
) -> Result<Self, ImagePyramidError>
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§
impl Freeze for ImagePyramid
impl RefUnwindSafe for ImagePyramid
impl Send for ImagePyramid
impl Sync for ImagePyramid
impl Unpin for ImagePyramid
impl UnwindSafe for ImagePyramid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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