0

Hi, I'm using ImageMagick 7.0.8-64 Q16 for Windows and MATLAB R2019. I'm doing the same operation (resizing with bicubic interpolation method) in both programs.

ImageMagick code:

magick start.png -resize 400x200! -interpolate Catrom -quality 100 start_magick_100.png

MATLAB code

start_matlab = imresize(start, [200 400], "bicubic")
imwrite(start_matlab, "start_matlab.png", "png")

Now, the difference is not visible but reading again both images in MATLAB and ImageJ they are a little bit different in terms of pixels count. I mean that the pixel count is the same but summing the image matrix in MATLAB give me a different result. How can it be possible? Do IM and Matlab could have different functions even for these simple operations?

  • What's the relation to graphic design? How do you expect a designer to answer this? Look at the golden ratio? :) – Lucian Sep 20 at 8:20
  • Sorry for the inappropriate location. Maybe some interpolation knowledge (that I lack) could be useful, but this might not be the right place! – Filippo Gambarota Sep 20 at 8:24
  • 2
    Try superuser, stackoverflow, etc. – Lucian Sep 20 at 8:25
  • 1
    I'm voting to close this question as off-topic because it belongs on Super-User or Stack Overflow – GerardFalla Sep 20 at 15:30
0

Different algorithms produces different result and both software handle interpolation differently.

Looking at your code gives a hint that you’re using catmull-rom algorithm for bicubic interpolation in image magic. It gives the smooth result but can’t be compared pixel to pixel with a different algorithm (matlab)

0

I will answer this quikly before it gets closed. The answer is simply:

Implementation details count.

So even if the math is the same. Processing might not be the same. Math and images themselves do not have a straight forward enough interpretation. Think:

  • How do you do the math in integer arithmetic
  • How do you round numbers?
  • Do you implement it all in one stage or not?
  • Do you process the image numbers in linear space?
    • or do you just do gamna correction.
    • or do you implement a cms?
    • or do you take the numbers at face value?

etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.