Code Monkey home page Code Monkey logo

Comments (14)

negezor avatar negezor commented on May 26, 2024 4

It would be nice to add a comparison with libvips.

from fast_image_resize.

Cykooz avatar Cykooz commented on May 26, 2024 3

@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.

Cykooz avatar Cykooz commented on May 26, 2024 1

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.

bend-n avatar bend-n commented on May 26, 2024 1

With threads turned off, the results look like this:

resizing

benchmark code: https://github.com/bend-n/imenchmark/blob/main/benches/resizing.rs

from fast_image_resize.

Cykooz avatar Cykooz commented on May 26, 2024 1

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).
OpenCV-resize

from fast_image_resize.

lucasjinreal avatar lucasjinreal commented on May 26, 2024

@Cykooz hoping for it!

from fast_image_resize.

vhbit avatar vhbit commented on May 26, 2024

I would also love to see comparison with libvips (not only raw performance, but also peak memory usage)

from fast_image_resize.

Cykooz avatar Cykooz commented on May 26, 2024

@bend-n Thank you for your work.

from fast_image_resize.

Cykooz avatar Cykooz commented on May 26, 2024

@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.

bend-n avatar bend-n commented on May 26, 2024

Oh yeah i forgot to rename the field to lanczos.

from fast_image_resize.

bend-n avatar bend-n commented on May 26, 2024

re: libvips, i cant seem to be able to get it to work properly.

from fast_image_resize.

bend-n avatar bend-n commented on May 26, 2024

Why is that? Is opencv bugged? How is it for upscaling?

from fast_image_resize.

Cykooz avatar Cykooz commented on May 26, 2024

Upscaling looks better. I don't know why downscaling is so bad.

from fast_image_resize.

Cykooz avatar Cykooz commented on May 26, 2024

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)

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.