image-pyramid

Crates.ioimage-pyramid
lib.rsimage-pyramid
version0.5.1
sourcesrc
created_at2024-05-16 07:00:24.101937
updated_at2024-05-26 02:53:55.84026
descriptionA small library to compute image pyramids
homepagehttps://github.com/jnickg/image-pyramid
repositoryhttps://github.com/jnickg/image-pyramid
max_upload_size
id1241834
size114,458
J Nicholas Giampietro (jnickg)

documentation

https://docs.rs/image-pyramid

README

Image Pyramid

Maintenance crates-io api-docs dependency-status

Overview

This is a small Rust crate that facilitates quickly generating an image pyramid from a user-provided image.

Usage

See the crates.io page for installation instructions, then check out the examples directory for example code. Below is a simple illustrative example of computing a default pyramid (Gaussian where each level is half resolution).

use image_pyramid::*;

let image = todo!();
let pyramid = match ImagePyramid::create(&image, None) {
    Ok(pyramid) => pyramid,
    Err(e) => {
        eprintln!("Error creating image pyramid: {}", e);
        return;
    }
};

Or a slightly more complex example, illustrating how to create a bandpass pyramid where each octave is $2\over{3}$ the resolution, smoothed using a triangle (linear) filter.

use image_pyramid::*;

let image = todo!();
let params = ImagePyramidParams {
    scale_factor: (2.0 / 3.0).into_unit_interval().unwrap(),
    pyramid_type: ImagePyramidType::Bandpass,
    smoothing_type: SmoothingType::Triangle
};
let pyramid = match ImagePyramid::create(&image, Some(&params)) {
    Ok(pyramid) => pyramid,
    Err(e) => {
        eprintln!("Error creating image pyramid: {}", e);
        return;
    }
};

The scale_factor field is a UnitIntervalValue, which must be in the interval $(0, 1)$. Creating a value of this type yields a Result and will contain an error if the value is not valid.

Support

Open an Issue with questions or bug reports, and feel free to open a PR with proposed changes.

Contributing

Follow standard Rust conventions, and be sure to add tests for any new code added.

Commit count: 7

cargo fmt