Cykooz / fast_image_resize

Rust library for fast image resizing with using of SIMD instructions.
Apache License 2.0
284 stars 25 forks source link

Equivalent to OpenCV cv2.INTER_AREA? #23

Closed FSund closed 6 months ago

FSund commented 6 months ago

Is there an equivalent to OpenCV's INTER_AREA algorithm in fast_image_resize?

See comparison here: https://gist.github.com/georgeblck/e3e0274d725c858ba98b1c36c14e2835

Cykooz commented 6 months ago

I am not sure, but if consider the information in the article it could be implemented with a custom filter:

fn area_filter(mut x: f64) -> f64 {
    x = x.abs();
    if x < 0.5 {
        1.0 - 2.0 * x
    } else {
        0.0
    }
}

let area = FilterType::Custom(
    Filter::new("Area", area_filter, 0.5).unwrap()
);
FSund commented 6 months ago

Thanks, I'll give that a go!