Page 1 of 1

Changes to equalize..

Posted: 2013-06-01T07:37:50-07:00
by dognose
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

Re: Changes to equalize..

Posted: 2013-06-01T08:28:38-07:00
by snibgo
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.

Re: Changes to equalize..

Posted: 2013-06-01T10:26:17-07:00
by fmw42
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

Re: Changes to equalize..

Posted: 2013-06-02T09:22:21-07:00
by dognose
Sorry, the old one was was 6.7.0-0

Re: Changes to equalize..

Posted: 2013-06-02T09:47:29-07:00
by snibgo
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

Re: Changes to equalize..

Posted: 2013-06-02T11:15:39-07:00
by fmw42
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

Re: Changes to equalize..

Posted: 2013-06-26T21:19:30-07:00
by anthony
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!

Re: Changes to equalize..

Posted: 2019-01-09T04:42:39-07:00
by mjamal
Hello All,

I am facing issue with the equalize effect for an image which is cropped from photoshop and cropped from our imagemagick script.
For image which is cropped from photoshop is showing perfect result of equalize whereas image which is cropped from imagemagick script is not matching with the photoshop equalize effect.

I am using ImageMagick 7.0.8 with CentOS 7.6.
Please see the below two input images and commands as well.

exec("convert maxBlack.png -channel RGB -equalize +channel MBEQ.png");
exec("convert maxBlack1.png -channel RGB -equalize +channel MBEQ1.png");

Please let me know your suggestions on this. And provide your views how I can get the exact result as per PS or is there any thing missing in my other image?

Image 1: https://www.dropbox.com/s/amgyv5xnoa0kr ... k.png?dl=0
Image 2: https://www.dropbox.com/s/tazqozaqhhyhr ... 1.png?dl=0
Output 1: https://www.dropbox.com/s/7cpziqwwrlyjwvz/MBEQ.png?dl=0
Output 2: https://www.dropbox.com/s/d8y4adszl6kb7 ... 1.png?dl=0

Re: Changes to equalize..

Posted: 2019-01-09T04:47:29-07:00
by snibgo
mjamal wrote:And provide your views how I can get the exact result as per PS ...
You haven't shown the results you get with Photoshop.

Re: Changes to equalize..

Posted: 2019-01-11T00:47:06-07:00
by mjamal
Hello Snibgo,

Please see the below photoshop output for the two inputs provided and let me know your feedback.
PS Output 1: https://www.dropbox.com/s/1dsm52jq7soab ... P.png?dl=0
PS Output 2: https://www.dropbox.com/s/qzitigftp86d4 ... P.png?dl=0

Re: Changes to equalize..

Posted: 2019-01-11T07:09:48-07:00
by snibgo
For your first image, this seems to give the same result as Photoshop:

Code: Select all

magick maxBlack.png -background Black -alpha background -channel RGB -equalize +channel e.png

Re: Changes to equalize..

Posted: 2019-01-14T23:49:09-07:00
by mjamal
Hi Snibgo.
Thanks a ton, from your provided command my issue is now resolved and we are testing with the different types of images and checking if it is solved permanently or not. I will let you know if found any difficulty or issues.

Thanks again.