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

no gaussian kernel #22

Closed Lishen1 closed 4 months ago

Lishen1 commented 7 months ago

unexpected but here no standard gaussian kernel as opencv has https://docs.opencv.org/4.x/d4/d1f/tutorial_pyramids.html

Cykooz commented 7 months ago

The interpolation argument of the resize() function has no value which mentions a Gaussian kernel:

https://docs.opencv.org/4.x/da/d54/group__imgproc__transform.html#ga5bb5a1fea74ea38e1a5445ca803ff121

Lishen1 commented 7 months ago

it used here https://docs.opencv.org/4.x/d4/d86/group__imgproc__filter.html#gaf9bba239dfca11654cb7f50f889fc2ff special case of 2 times downsampling

Cykooz commented 7 months ago

You can use custom filter to implement Gaussian filter.

In other libraries (Pillow, libvips, OpenCV) I didn't see the use of Gaussian kernel for an "universal" resize function. Usually these libraries use a Gaussian filter to blur images.

Lishen1 commented 7 months ago

yep, thanks, custom filter is a way. a little bit confused by using f64 (i think it's too precise ) . btw this lib has gaussian filter https://github.com/image-rs/image/blob/2b513ae9a6ac306e752914f562e7d408f096ba3f/src/imageops/sample.rs#L909

Cykooz commented 7 months ago

Thank you for link to Gaussian implementation from image-rs. I will use it to add Gaussian filter into fast_image_resize in future.

Cykooz commented 7 months ago

a little bit confused by using f64

I copied it from Pillow - https://github.com/python-pillow/Pillow/blob/main/src/libImaging/Resample.c I don't know why they decided to use double instead of float.

Cykooz commented 4 months ago

I have added Gaussian filter in version 4.0.0