possible bug -median IM 6.6.9.3

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug -median IM 6.6.9.3

Post by fmw42 »

IM 6.6.9.3 Q16 Mac OSX Tiger

One of my scripts, isonoise, is not working as it used to. I get no change from the input image. The problem seems to stem from -median radius. It seems that radius=1 no longer makes any change to my image. I have to up the radius to 2 to get any effect. Has the definition or use of radius been changed at some point in -median? A radius=1 should mean a window of 3x3, if I understand its use correctly. Might this have to do with using same code for both -statistic median and for -median and how the window size is computed differently for each (size=2radius+1 for -median and size=size specified for -statistic)?

The script was last revised but working fine on 10/25/2007, so unfortunately many releases have gone by and I had not tested the script for quite a while.

input:
Image

convert gray_noise98.png -median 1 gray_noise98_med1.png
compare -metric rmse gray_noise98.png gray_noise98_med1.png null:
0 (0)
Last edited by fmw42 on 2011-04-01T17:06:16-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug -median IM 6.6.9.3

Post by magick »

The median option supports geometry of width x height. We can support a radius with one number (e.g. -median 1) and width x height (e.g. -median 5x3) if you prefer. Note, -median 0 behaves as it did previously. It finds the optimal kernel width for the quantum depth of ImageMagick (typically 5x5).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -median IM 6.6.9.3

Post by fmw42 »

magick wrote:The median option supports geometry of width x height. We can support a radius with one number (e.g. -median 1) and width x height (e.g. -median 5x3) if you prefer.

The issue is that -median 1 used to mean a 3x3 window. But now it means a 1x1 window. So the argument value has a different effect.

You must have changed it from -median radius to conform with -statistic median. I will change my scripts to accommodate the new more flexible argument, unless others feel that broken backward compatibility is bad. Please speak up or it will be left as is now.


If we go with the current format -median widthxheight, what release do I use for my script to make the switch. I assume it is 6.6.8-6 from the changelog.

I assume if one only uses only one value it used for both width and height. Is that correct?

Note the option page docs still say

-median radius

So I will edit that as well if appropriate.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug -median IM 6.6.9.3

Post by anthony »

Perhaps it is time to add warnings about 'depreciated' options.

I mean -pen is still around even though it has not been used since IM v5 or was that IM v4!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply