Page 1 of 1
Possible Bug/New Feature -- Skewness Skewed? Median metric?
Posted: 2014-02-22T19:52:30-07:00
by blue-j
I may be mistaken, but i am seeing the skewness measure out of line with the distribution, as if it's opposite (negative switch to positive values). I believe skewness is supposed to be a negative value for skewed left distributions, and positive skewed right, but it seems ImageMagick is returning the opposite, if the histogram output is the reference. The histogram output shows more value on the right side with a negative skewness value, and on the left with a positive skewness.
I apologize, statistics is not a particular strength of mine, and I may have a misunderstanding. I thank you for any attention you might pay to this.
Also, it appears there is no shortcut way to query the median statistic of an image. Is that mistaken? This would be useful to our efforts.
Hope you are well!
J
Re: Possible Bug/New Feature -- Skewness Skewed? Median met
Posted: 2014-02-22T22:02:47-07:00
by fmw42
For the median,
as a temporary workaround, this should work, I think, to get the median per channel. The input image is 128x128 so make the median size the same as the dimensions of the input. It won't be efficient for large images as the result (saved as an image) will be a constant value of the median at all pixels of the output, which would be the same size as the input.
convert zelda3.png -virtual-pixel tile -statistic median 128x128 -format "%[pixel:u.p{0,0}]" info:
srgb(173,142,127)
But I would agree that it would be nice and much more efficient, if the 8-bit median per channel would also be reported in the verbose information or included by a -define or as the following syntax similar to -moments
Code: Select all
identify -verbose -median image.png
Or better would be the median 8-bit color, from the histogram. Of course this can be found by sorting the histogram and finding the most populated color
[/b]
But this is problematic, since there may be many colors with the same max count as for example:
Code: Select all
convert zelda3.png -depth 8 -format "%c" histogram:info:- | tr -cs "[0-9]*\n" " " | sort -k 1 -r | sed -n 's/^[ ]*\([0-9]* [0-9]* [0-9]* [0-9]*\).*$/\1/p'
Code: Select all
9 190 17 37
9 177 12 28
9 171 7 23
9 168 7 23
9 168 158 150
9 168 154 150
9 164 150 139
9 162 147 139
9 162 144 142
9 160 142 134
9 160 142 131
9 158 144 136
9 156 136 127
9 154 136 127
9 136 7 17
9 136 120 111
8 190 23 37
8 190 17 33
8 182 12 33
8 178 12 28
8 169 160 158
8 168 158 144
8 168 154 144
8 166 150 144
8 166 147 136
8 162 150 139
8 162 144 139
8 162 142 139
8 160 144 136
8 156 136 125
8 156 134 127
8 154 139 125
8 152 134 125
8 152 131 125
8 150 129 122
8 147 7 17
8 147 131 125
8 144 122 115
8 134 2 17
7 28 23 17
7 186 12 33
7 176 12 28
7 174 7 23
7 172 7 23
7 169 162 156
7 169 162 152
7 169 160 154
7 168 158 147
7 168 156 147
So whether one gets the median per channel or the median color, one has to deal with colors or grayscale values that have the same max count. So how should this be handled?
Re: Possible Bug/New Feature -- Skewness Skewed? Median met
Posted: 2014-02-24T19:34:36-07:00
by blue-j
I wish I could be of more help. I've done research on this but am not a statistics-savvy person enough to know how to resolve the matter.
Regarding skewness, I have researched the matter and discovered that ImageMagick is reporting the values correctly. False alarm there, so sorry!
J