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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
vadim
Posts: 7
Joined: 2015-07-02T10:05:21-07:00
Authentication code: 1151
Contact:

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Contact:

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

Post 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)
vadim
Posts: 7
Joined: 2015-07-02T10:05:21-07:00
Authentication code: 1151
Contact:

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

Post 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.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot] and 6 guests