Code Monkey home page Code Monkey logo

blurslice's Introduction

blurslice

Documentation Crates.io

A fast linear-time gaussian blur based on http://blog.ivank.net/fastest-gaussian-blur.html.

This implementation was based on https://github.com/fschutt/fastblur.

These functions in-place blur a given slice of (presumably) image data, with any number of channels and the given blur radius. Performance is roughly linear time, and uses a single allocation for a backing store, of the same size as the input slice.

Example

Blur an RgbImage

fn blur_fast(rgb_image: &mut image::RgbImage, radius: f32) -> Result<(), blurslice::SliceSizeError> {
    let width = rgb_image.width() as usize;
    let height = rgb_image.height() as usize;
    let samples = rgb_image.as_flat_samples_mut();
    blurslice::gaussian_blur_bytes::<3>(samples.samples, width, height, radius)
}

Changes:

  • Support any number of channels via const generics
  • No allocation for passes list generation, uses const generic stack array

TODO:

  • Support arbitrary stride, for over-aligned data or vertical image sub-slices
  • Allow providing a backing store, to allow for zero-allocation execution

blurslice's People

Contributors

lsr0 avatar

Stargazers

 avatar liyiheng avatar bendn avatar

Watchers

 avatar  avatar

Forkers

bend-n liyiheng

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.