How do I do high quality scaling of a image?

后端 未结 11 999
温柔的废话
温柔的废话 2021-01-30 15:19

I\'m writing some code to scale a 32 bit RGBA image in C/C++. I have written a few attempts that have been somewhat successful, but they\'re slow and most importantly the qualit

相关标签:
11条回答
  • 2021-01-30 15:22

    Take a look at ImageMagick, which does all kinds of rescaling filters.

    0 讨论(0)
  • 2021-01-30 15:23

    Intel has IPP libraries which provide high speed interpolation algorithms optimized for Intel family processors. It is very good but it is not free though. Take a look at the following link:

    Intel IPP

    0 讨论(0)
  • 2021-01-30 15:24

    A fairly simple and decent algorithm to resample images is Bicubic interpolation, wikipedia alone has all the info you need to get this implemented.

    0 讨论(0)
  • 2021-01-30 15:28

    CodeProject articles discussing and sharing source code for scaling images:

    • Two Pass Scaling using Filters
    • Matrix Transformation of Images in C#, using .NET GDI+
    • Resizing a Photographic image with GDI+ for .NET
    • Fast Dyadic Image Scaling with Haar Transform
    0 讨论(0)
  • 2021-01-30 15:28

    As a follow up, Jeremy Rudd posted this article above. It implements filtered two pass resizing. The sources are C# but it looks clear enough that I can port it to give it a try. I found very similar C code yesterday that was much harder to understand (very bad variable names). I got it to sort-of-work, but it was very slow and did not produce good results which led me to believe there was an error in my adaptation. I may have better luck writing it from scratch with this as a reference, which I'll try.

    But considering how the two pass algorithm works I wonder if there isn't a faster way of doing it, perhaps even in one pass?

    0 讨论(0)
  • 2021-01-30 15:33

    It sounds like what you're really having difficulty understanding is the discrete -> continuous -> discrete flow involved in properly resampling an image. A good tech report that might help give you the insight into this that you need is Alvy Ray Smith's A Pixel Is Not A Little Square.

    0 讨论(0)
提交回复
热议问题