Issue : Equalize transformation unexpectedly brightens the blacks

Moderator: jsachs

Post Reply
pierrelabreche
Posts: 548
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Issue : Equalize transformation unexpectedly brightens the blacks

Post by pierrelabreche »

In the screenshot below, a gray wedge is equalized flat.
The blacks are not equalized as expected. The oroginal black ( 0% ) is brightened to an HSV-V value of 8,6.
2024-06-19 Equalize results on  step wedge.jpg
2024-06-19 Equalize results on step wedge.jpg (68.26 KiB) Viewed 914 times
Equalized step wedge output
2024-06-19 Equalize step wedge.jpg
2024-06-19 Equalize step wedge.jpg (18.94 KiB) Viewed 914 times
Script is attached
2024-06-19 Equalize step wedge.jpg.script
(1.37 KiB) Downloaded 57 times
jsachs
Posts: 4398
Joined: January 22nd, 2009, 11:03 pm

Re: Issue : Equalize transformation unexpectedly brightens the blacks

Post by jsachs »

There are spikes in the input image histogram at white and black, presumably due to the borders between the patches. If you use a linear gradient as the input image instead I think you will see what your were expecting.
Jonathan Sachs
Digital Light & Color
pierrelabreche
Posts: 548
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: Issue : Equalize transformation unexpectedly brightens the blacks

Post by pierrelabreche »

The large black patch ( 0% ) should be taken into account in the equalization process. The value of pure black in the output image, i.e. after equalization , should remain pure black.

The spikes are due to the uniform patches and white text.

The resulting range of values appears biased away from black.

Will experiment later with gradient.
jsachs
Posts: 4398
Joined: January 22nd, 2009, 11:03 pm

Re: Issue : Equalize transformation unexpectedly brightens the blacks

Post by jsachs »

>>The large black patch ( 0% ) should be taken into account in the equalization process. The value of pure black in the output image, i.e. after equalization , should remain pure black.

That's not how it works. The first non-zero output histogram value is biased toward white to reduce the excess amount of pure black from the labels and borders in the input image.
equal.jpg
equal.jpg (8.49 KiB) Viewed 902 times
When you test with Linear Gradient, make sure you set the transition between black and white to Line and not Sine.
Jonathan Sachs
Digital Light & Color
pierrelabreche
Posts: 548
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: Issue : Equalize transformation unexpectedly brightens the blacks

Post by pierrelabreche »

jsachs wrote: June 20th, 2024, 6:50 am The first non-zero output histogram value is biased toward white to reduce the excess amount of pure black from the labels and borders in the input image.

I did one more experiment with the grey step wedge, whereby I applied a gray curve to the input image so that it is not pure black, just to see if pure black was especially ignored.
2024-06-20 Equalize results on  step wedge, after brightening to HSV-V 2.jpg
2024-06-20 Equalize results on step wedge, after brightening to HSV-V 2.jpg (68.24 KiB) Viewed 892 times
Quoting the help for Equalize:
Standard histogram equalization works by trying to adjust the image to a flat curve as illustrated below. This causes each tonal values in the output image to be roughly equally represented,
The Equalize curve is flat, that is, all tones between pure black and pure white are desired to be equally distributed. The output histogram is showing that tonal values in the output image are not equally represented. The black tones which are largely present, as shown with the left peak in the input histogram, are absent in the output image's tonal range.

The experiment shows that even with dark grey ( HSV-V = 2 ), the output histogram remains tilted towards whites.
Gradient experiments to follow.
pierrelabreche
Posts: 548
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: Issue : Equalize transformation unexpectedly brightens the blacks

Post by pierrelabreche »

jsachs wrote: June 20th, 2024, 6:50 am >>
That's not how it works. The first non-zero output histogram value is biased toward white to reduce the excess amount of pure black from the labels and borders in the input image.
...
When you test with Linear Gradient, make sure you set the transition between black and white to Line and not Sine.
I experimented using a test pattern consisting of a a pure gradient. The results are identical after equalization, as expected.

I then created another experiment with a pattern involving all tones by applying the linear gradient to a Star test pattern, using Hard light.
The resulting pattern is well-balanced : it consists of light and dark tones instead of the pure black and white original star pattern.
The results are shown below.
The equalize transformation treats differently the light and the dark tones. Probing the pure black shows it is substantially lightened, whereas the whites are not darkened to the same degree. There is a noticeable step tonal change at the 0 and 180 degrees rays.
2024-06-27 PWP8  Equalize Test pattern Star with gradient-hard light-screenshot v2.jpg
2024-06-27 PWP8 Equalize Test pattern Star with gradient-hard light-screenshot v2.jpg (153.58 KiB) Viewed 812 times
Attachments
2024-06-27 PWP8  Equalized Test pattern Star with gradient-hard light - resized.jpg
2024-06-27 PWP8 Equalized Test pattern Star with gradient-hard light - resized.jpg (125.46 KiB) Viewed 812 times
Post Reply