fast_image_resize icon indicating copy to clipboard operation
fast_image_resize copied to clipboard

no gaussian kernel

Open Lishen1 opened this issue 11 months ago • 6 comments

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

Lishen1 avatar Feb 28 '24 21:02 Lishen1

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

Cykooz avatar Feb 29 '24 07:02 Cykooz

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

Lishen1 avatar Feb 29 '24 07:02 Lishen1

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.

Cykooz avatar Feb 29 '24 08:02 Cykooz

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

Lishen1 avatar Feb 29 '24 08:02 Lishen1

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 avatar Feb 29 '24 08:02 Cykooz

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 avatar Feb 29 '24 10:02 Cykooz