Page 1 of 1

Should '-median' and '-statistic median' produce same result, and what are their parameters?

Posted: 2015-07-02T10:35:49-07:00
by vadim
Documentation says '-median' ' is legacy option from the method of the same name', so I'd expect them be identical. However, running 4 commands:

Code: Select all

convert LOGO: -median 3x3 m33.png
convert LOGO: -median 3 m3.png
convert LOGO: -statistic median 3x3 sm33.png
convert LOGO: -statistic median 3 sm3.png
I'm getting 4th image (sm3.png) different from the others. Replacing all '3's with '5's -- all four images are the same. Replacing with '7's -- again the 4th image is different.

And, maybe I missed it, documentation is not clear how 'geometry' parameter is interpreted. Is it radius? Is it a rectangular box width and height? (So, e.g., for '3x3' there are 8 pixels affecting current pixel, for '5x5' -- 24, etc. Then what about even or fractional parameters?)

Code: Select all

Version: ImageMagick 6.9.1-1 Q16 x86 2015-03-20 http://www.imagemagick.org

Re: Should '-median' and '-statistic median' produce same result, and what are their parameters?

Posted: 2015-07-02T10:43:46-07:00
by fmw42
-median uses one value as the radius: -median 1 --> 3x3 size (size = 2*radius+1 x 2*radius+1)

-statistic median use two values for the x and y dimensions: -statistic median 3x3 (should be the equivalent of -median 1)

Re: Should '-median' and '-statistic median' produce same result, and what are their parameters?

Posted: 2015-07-02T12:20:44-07:00
by vadim
It should be, but it isn't? Strange results when supplying '-statistic median' with single numeric parameter are confusing, too. At least we can hope 'WxH' parameter is box size, indeed. Thanks for your answer.