question - Equalize transformation and banding in output image

Moderator: jsachs

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

question - Equalize transformation and banding in output image

Post by pierrelabreche »

The Equalize transformation produces banding in the output image, as visible on histograms.
This banding effect is not present when using 16-bit grayscale or 48-bit color images as input.

I tried to reproduce the banding effect using the test pattern "cosine falloff".

Question : is there a problem with the Equalize transform when the component planes are 8-bits, or is it recommended to convert to 16-bits planes before applying Equalize, to prevent gaps in the histogram ?

Banding is not present if
  • an 8-bit or 24-bit image is first converted to 16-bit or 48-bi,
  • equalize performed, and
  • the result is converted back to 8-bit or 24-bit.
See screenshots below
2024-06-15 PWP equalize transformation with banding per histogram, 8-bitsgrayscale .jpg
2024-06-15 PWP equalize transformation with banding per histogram, 8-bitsgrayscale .jpg (45.46 KiB) Viewed 926 times
2024-06-15 PWP equalize transformation with continuous histogram, 8-bits grayscale .jpg
2024-06-15 PWP equalize transformation with continuous histogram, 8-bits grayscale .jpg (47.3 KiB) Viewed 926 times
Test workflow:
jsachs
Posts: 4296
Joined: January 22nd, 2009, 11:03 pm

Re: question - Equalize transformation and banding in output image

Post by jsachs »

Any very steep curves such as the ones in your example are likely to produce banding. Not all curves created by Equalize as as extreme as this example, but I recommend using 16-bit images whenever possible to reduce posterization.
Jonathan Sachs
Digital Light & Color
pierrelabreche
Posts: 492
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: question - Equalize transformation and banding in output image

Post by pierrelabreche »

What I find unusual is that the results are very different when Equalize is applied to 16-bit images.


Compare:
  • 8-bit image -> Equalize
  • 8-bit image -> convert to 16 bits -> Equalize -> convert back to 8 bits
Could the banding be due to floating point quantization or integer calculations rounding error ?
jsachs
Posts: 4296
Joined: January 22nd, 2009, 11:03 pm

Re: question - Equalize transformation and banding in output image

Post by jsachs »

Equalize simply computes the curve necessary to more or less match a given histogram. Then it applies the curve to the input image just like Brightness Curve. When PWP converts images from 8-bit to 16-bit it fills the extra bits with random data. This is a standard signal processing technique call dithering. Thus the 16-bit image has a more even distribution of values, not just the original 256. I assume this is what makes the difference when you apply steep curves and then convert back to 8-bit.
Jonathan Sachs
Digital Light & Color
pierrelabreche
Posts: 492
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: question - Equalize transformation and banding in output image

Post by pierrelabreche »

There is one thing that I find intriguing.

1. The input image appears to have a continuous histogram without banding gaps.
2. When the amount control in the transformation is in the middle scale, say 25%, I would expect the output to be a blend of the input weighted at 25% and the transformation's output weighted at 75%. I do not understand why there would be banding in the output histogram.

See screen shots, below and in additional replies to work around the 3 attachments limitation.
vlcsnap-2024-06-17-11h32m22s126.jpg
vlcsnap-2024-06-17-11h32m22s126.jpg (34.84 KiB) Viewed 895 times
vlcsnap-2024-06-17-11h33m43s347.jpg
vlcsnap-2024-06-17-11h33m43s347.jpg (53.7 KiB) Viewed 895 times
vlcsnap-2024-06-17-11h34m40s800.jpg
vlcsnap-2024-06-17-11h34m40s800.jpg (55.63 KiB) Viewed 895 times
pierrelabreche
Posts: 492
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: question - Equalize transformation and banding in output image

Post by pierrelabreche »

vlcsnap-2024-06-17-11h35m21s817.jpg
vlcsnap-2024-06-17-11h35m21s817.jpg (59.72 KiB) Viewed 895 times
vlcsnap-2024-06-17-11h36m02s653.jpg
vlcsnap-2024-06-17-11h36m02s653.jpg (56.53 KiB) Viewed 895 times
vlcsnap-2024-06-17-11h36m37s416.jpg
vlcsnap-2024-06-17-11h36m37s416.jpg (55.39 KiB) Viewed 895 times
pierrelabreche
Posts: 492
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: question - Equalize transformation and banding in output image

Post by pierrelabreche »

vlcsnap-2024-06-17-11h36m37s416.jpg
vlcsnap-2024-06-17-11h36m37s416.jpg (55.39 KiB) Viewed 895 times
vlcsnap-2024-06-17-11h36m47s773.jpg
vlcsnap-2024-06-17-11h36m47s773.jpg (57.85 KiB) Viewed 895 times
vlcsnap-2024-06-17-11h37m03s145.jpg
vlcsnap-2024-06-17-11h37m03s145.jpg (49.74 KiB) Viewed 895 times
pierrelabreche
Posts: 492
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: question - Equalize transformation and banding in output image

Post by pierrelabreche »

I should have written :
There is one thing that I find intriguing.

1. The input image appears to have a continuous histogram without banding gaps.
2. When the amount control in the transformation is in mid-scale, say 75%, I would expect the output to be a blend of the input weighted at 25% and the transformation's output weighted at 75%. I do not understand why there would be banding in the output histogram.
jsachs
Posts: 4296
Joined: January 22nd, 2009, 11:03 pm

Re: question - Equalize transformation and banding in output image

Post by jsachs »

Because the output image has banding before it is blended with the input image.
Jonathan Sachs
Digital Light & Color
pierrelabreche
Posts: 492
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: question - Equalize transformation and banding in output image

Post by pierrelabreche »

Because the output image has banding before it is blended with the input image.
Thank you. I was under the impression that because the input was continuous, the blended output should also be.

I found with further investigation that the output histogram is indeed continuous in the transformation dialog box, but not in the histogram mode display.
Equalize transform: Output Curve
The output curve displays the curve that Equalize applies to the input image to create the output image. The histogram in the background is the histogram of the output image.
Histogram mode : Input/Output Image Histograms
When a transformation dialog box is open, the histogram is computed from either the input or the output image. If the display tool bar at the top of the dialog box is set to show just the input image, the histogram is computed from the input image. Otherwise the histogram is computed from the output image
See screenshot below, where there is a discrepancy between the two histograms.
Shouldn't both histograms be similar, because they both represent the preview/output image ?
2024-06-19 Equalize results on Cosine falloff - histograms discrepancy.jpg
2024-06-19 Equalize results on Cosine falloff - histograms discrepancy.jpg (55.01 KiB) Viewed 853 times
Post Reply