Changes to equalize..

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?".

Changes to equalize..

Postby dognose » 2013-06-01T07:37:50+00:00

I'm noticing some changes to the result for -equalize
from IM 6.7 to IM 6.8.2
I have included the -colorspace RGB change (without it's even worse) ..
Anyone know what else changed, and how I get the old effect back?

Original
Image

6.7 -equalize
Image

6.8.2 -colorspace RGB -equalize
Image
dognose
 
Posts: 219
Joined: 2005-03-08T22:16:37+00:00

Re: Changes to equalize..

Postby snibgo » 2013-06-01T08:28:38+00:00

Exactly which v6.7? Colorspaces (including greyscale) changed a lot during that version. Using your mountain photo:

Code: Select all
"%IMG679%convert" mountains.jpg -set colorspace RGB -equalize e679.png
"%IMG682%convert" mountains.jpg -set colorspace RGB -equalize e682.png
"%IMG685%convert" mountains.jpg -set colorspace RGB -equalize e685.png
"%IMG685%convert" mountains.jpg -equalize e685s.png

"%IMG%compare" -metric RMSE e679.png e682.png NULL:
370.232 (0.00564937)

"%IMG%compare" -metric RMSE e679.png e685.png NULL:
3614.96 (0.0551607)

"%IMG%compare" -metric RMSE e685.png e685s.png NULL:
0 (0)


v6.7.9 and v6.8.2 give virtually identical results.

The two examples of 6.8.5 (with and without set colorspace RGB) are the same as each other, and each is slightly lighter than 6.7.9 or 6.8.2. I don't know why, or which is more correct.
snibgo's IM pages: im.snibgo.com
snibgo
 
Posts: 3846
Joined: 2010-01-23T23:01:33+00:00

Re: Changes to equalize..

Postby fmw42 » 2013-06-01T10:26:17+00:00

colorspace changes occurred as snibgo said during 6.7.6.7 and 6.7.7.7 but equalize needs the grayscale image to work on and grayscale did not become stable until about 6.7.8.3 at which time it needed to have -set colorspace RGB added so that the grayscale image was non-linear. The need for -set colorspace RGB was not removed until 6.8.5.5
User avatar
fmw42
 
Posts: 14898
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: Changes to equalize..

Postby dognose » 2013-06-02T09:22:21+00:00

Sorry, the old one was was 6.7.0-0
dognose
 
Posts: 219
Joined: 2005-03-08T22:16:37+00:00

Re: Changes to equalize..

Postby snibgo » 2013-06-02T09:47:29+00:00

I don't have 6.7.0-0. I do have 6.6.2-4, and the results look like those from your 6.7.0.

Code: Select all
"%IMG662%convert" mountains.jpg -set colorspace RGB -equalize e662.png

The result shows a heavy red colour cast in the shadows, which suggests it is processing the channels separately. We can emulate this in a more recent IM version (Windows 7 script):
Code: Select all
"%IMG6858%convert" mountains.jpg ^
  -separate ^
  ( -clone 0 -equalize ) ^
  ( -clone 1 -equalize ) ^
  ( -clone 2 -equalize ) ^
  -delete 0-2 ^
  -combine ^
  e6858sep.png

"%IMG%compare" -metric RMSE e662.png e6858sep.png NULL:
69.8887 (0.00106643)

The result is almost identical.

So, if you really like the old method of equalization, you might either keep an old version of IM, or use my code above.

EDIT: or, a much better equivalent command:
Code: Select all
"%IMG6858%convert" mountains.jpg ^
  -channel RGB ^
  -equalize ^
  e6858ch.png
snibgo's IM pages: im.snibgo.com
snibgo
 
Posts: 3846
Joined: 2010-01-23T23:01:33+00:00

Re: Changes to equalize..

Postby fmw42 » 2013-06-02T11:15:39+00:00

The difference may be that before, IM was always equalizing each channel separately. That was changed at some point so the use had control, but the default was to equalize globally. see changelog at http://www.imagemagick.org/script/changelog.php

Code: Select all
2012-08-28 6.7.9-3 Cristy <quetzlzacatenango@image...>
Support -channel sync option for -equalize (reference http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=21746).



Here are the two different results using IM 6.8.5.9 (if before 6.8.5.5, you would need to add -set colorspace RGB before -equalize)

Together
convert h3eVjuZ.jpg -equalize h3eVjuZ_equal_6859.jpg
Image


Separately
convert h3eVjuZ.jpg -channel rgb -equalize h3eVjuZ_equal_rgb_6859.jpg
Image
User avatar
fmw42
 
Posts: 14898
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: Changes to equalize..

Postby anthony » 2013-06-26T21:19:30+00:00

Okay looks as if you are wanting to equalize all channels separately generating color skew, so that the green hills are -- not so green

For example old method (with color skew) is equivalent to removing the 'sync' flag from the channel settings.
Code: Select all
convert h3eVjuZ.jpg -channel RGB -equalize +channel show:


The default
Code: Select all
convert h3eVjuZ.jpg -equalize show:

avoids this by generating one equalization histogram for all channels simultaneously, and as such tries to prevent color skew (in perceptual (sRGB) colorspace)

Another method of equalizing without color skew was to try and separate (and equalize) intensity, from the other color components of the image. This was an old example I found, using Brightness.
Code: Select all
convert h3eVjuZ.jpg  -colorspace HSB -channel B -equalize +channel -colorspace sRGB show:


However HSB is really a horribly distorted colorspace, perhaps using LUV colorspace is better?
Code: Select all
convert h3eVjuZ.jpg -colorspace LUV -channel R -equalize +channel -colorspace sRGB show:

That last looks the best to me.

The green areas are darker but not color skewed, while the mountains are not getting washed out and overly bright.

But then I am not certain exactly what you want, as you never actually specified what you are actually after, or what is wrong, only that -equalize operation changed!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/
User avatar
anthony
 
Posts: 8731
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia


Return to Users

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 14 guests