Show only rmse statistics?

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
pauledd
Posts: 11
Joined: 2017-06-09T00:46:07-07:00
Authentication code: 1151

Show only rmse statistics?

Post by pauledd » 2017-06-10T06:30:40-07:00

Hi

I use this command line to show some stats that I need from my images because I only need mean/min/max/std.dev and bit depth of all channels:
And I need rmse values only, not the one that goes from 0-1 or 0-255

Code: Select all

identify -verbose ../image.cr2 | grep 'min\|max\|mean\|deviation\|Red\|Green\|Blue\|Overall\|Gray
 Red: 16-bit
    Green: 16-bit
    Blue: 16-bit
    Red:
      min: 39987 (0.610163)
      max: 65535 (1)
      mean: 56933 (0.868743)
      standard deviation: 1790 (0.0273137)
    Green:
      min: 31874 (0.486366)
      max: 65535 (1)
      mean: 52995.1 (0.808654)
      standard deviation: 1429.62 (0.0218147)
    Blue:
      min: 51791 (0.79028)
      max: 65535 (1)
      mean: 65453 (0.998748)
      standard deviation: 565.024 (0.00862172)
    Overall:
      min: 31874 (0.486366)
      max: 65535 (1)
      mean: 58460.4 (0.892048)
      standard deviation: 5374.79 (0.0820141)
    dng:Green: 1.103
'
Is there a more elegant way to output this?

snibgo
Posts: 11913
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Show only rmse statistics?

Post by snibgo » 2017-06-10T07:15:24-07:00

You can use "-format anything".

For "anything": %[fx:mean.r] gives mean in red channel, %[fx:standard_deviation.g] gives SD of green channel, etc.

RMSE is a measure of difference between two images, so what do you want for that?
snibgo's IM pages: im.snibgo.com

pauledd
Posts: 11
Joined: 2017-06-09T00:46:07-07:00
Authentication code: 1151

Re: Show only rmse statistics?

Post by pauledd » 2017-06-10T08:59:24-07:00

With "%[fx:mean.r]" I get decimals from 0 to 1 but I need the integer values from 0 to 65535 (with 16bit images) as seen in the verbose output. I need this numbers because they are standart in astronomical software.

pauledd
Posts: 11
Joined: 2017-06-09T00:46:07-07:00
Authentication code: 1151

Re: Show only rmse statistics?

Post by pauledd » 2017-06-10T09:18:31-07:00

I found it: using "%[fx:65535*mean.r]" I get my desired number.

User avatar
fmw42
Posts: 25259
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Show only rmse statistics?

Post by fmw42 » 2017-06-10T10:13:22-07:00

You can also do that with %[mean] after selecting the red channel. See http://www.imagemagick.org/script/escape.php %[fx: ... ] results in values between 0 and 1. %{statistic] gives values between 0 and quantumrange, where quantumrange depends upon your IM Q level. For Q16, the values will be 0 to 65535.

pauledd
Posts: 11
Joined: 2017-06-09T00:46:07-07:00
Authentication code: 1151

Re: Show only rmse statistics?

Post by pauledd » 2017-06-11T09:55:37-07:00

Is there also an "median" statistic available from identify? Modern astronomy application do have a median value.

Like here from PixInsight:
count (%) 100.00000
count (px) 18103008
mean 6688.487
median 7316.994
stdDev 1845.198
minimum 2133.722
maximum 10527.492

snibgo
Posts: 11913
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Show only rmse statistics?

Post by snibgo » 2017-06-11T10:47:18-07:00

pauledd wrote:Is there also an "median" statistic available from identify?
No. Fred has a script for bash, which I think uses 256 bins. I have a Windows BAT script that uses the full Quantum of whatever IM you are using.

EDIT: I forgot, I also has a process module that sorts, so the median can be found in a single command.
snibgo's IM pages: im.snibgo.com

Post Reply