Comments (14)
It would be nice to add a comparison with libvips.
from fast_image_resize.
@negezor I've done first comparison of libvips
with fast_image_resize
.
I've used libvips
v8.12.1 from Ubuntu 22.04 repository.
libvips
was tested in single-threaded mode with disabled caches.
Nearest | Box | Bilinear | CatmullRom | Lanczos3 | |
---|---|---|---|---|---|
libvips | 21.64 | 193.67 | 51.93 | 78.48 | 104.58 |
fir rust | 0.86 | 61.49 | 97.43 | 165.89 | 232.39 |
fir avx2 | - | 20.23 | 21.74 | 28.14 | 41.13 |
from fast_image_resize.
I have not yet done a benchmark to measure the speed of opencv.
I plan to do that after I add multithreading support. Because, as I understand it, opencv already has this feature.
from fast_image_resize.
With threads turned off, the results look like this:
benchmark code: https://github.com/bend-n/imenchmark/blob/main/benches/resizing.rs
from fast_image_resize.
I have found out that OpenCV returns incorrect results if we downscale image with different interpolations. All results, except INTER_AREA, look like INTER_NEAREST. With such results I'll can't make any correct benchmarks.
Image bellow is result of downscaling with different interpolations (result was upscaled x2 for better pixels visibility).
from fast_image_resize.
@Cykooz hoping for it!
from fast_image_resize.
I would also love to see comparison with libvips
(not only raw performance, but also peak memory usage)
from fast_image_resize.
@bend-n Thank you for your work.
from fast_image_resize.
@bend-n I have only one note about your opencv benchmark. OpenCV doesn't have Lanczos3 implementation. It has only Lanczos4. Lanczoz4 is more complicated (requires more calculations) than Lanczos3.
from fast_image_resize.
Oh yeah i forgot to rename the field to lanczos
.
from fast_image_resize.
re: libvips, i cant seem to be able to get it to work properly.
from fast_image_resize.
Why is that? Is opencv bugged? How is it for upscaling?
from fast_image_resize.
Upscaling looks better. I don't know why downscaling is so bad.
from fast_image_resize.
I've understood the reason. OpenCV uses "convolution" with fixed kernel size (it is essentially just Affine Transformations). In this case, downscaling very big image into very small one looks like a result of nearest "interpolation".
fast_image_resize uses convolution with adaptive kernel size. It requires more computations but makes more beter result.
It seems that only INTER_AREA in OpenCV uses real convolution with Box filter and minimal kernel size 1x1px.
from fast_image_resize.
Related Issues (15)
- Add other PixelTypes HOT 8
- Wasm32 support HOT 3
- resize_with_pad HOT 5
- Bad unsafe is caught by latest rust nightly (rustc 1.70.0-nightly (2eaeb1eee 2023-04-05)) HOT 5
- Crop source slice length does not match destination slice length HOT 3
- Allow passing an immutable slice to Image::from_slice_u8 HOT 2
- num-traits error HOT 2
- Preparation of a large number of images in a loop HOT 6
- f32 example HOT 2
- Downscaling in linear color space? HOT 5
- valgrind memcheck detects reads of unitialized memory memory HOT 3
- ImageView::from_buffer returns an error if the provided buffer larger than the minimum required size HOT 1
- LumaA pixels HOT 3
- [BUG] Return zero if the size of the input is equal to the output HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast_image_resize.