Subsections


Histogram

The histogram allows an immediate view of the contrast amplitude of an image with its distribution of luma and colors values. If the columns of values occupy the whole range 0 - 100% then we have maximum contrast; if the range is smaller the contrast is smaller. If most of the values are on the right of the histogram you have an image with highlights at the limit with values clamped to 1.0. This is called overexposure. However, if most of the values are moved to the left, with the limit of the values clamped to 0, we have a lowlight image and we talk about underexposure. Histogram is keyframble (figure 10.46).

Figure 10.46: Master Histogram and RGB Histogram
Image histogram

The Histogram is always performed in floating point RGB regardless of the project color space. The histogram has two sets of transfer parameters: the input transfer and the output transfer. The input transfer has value on the horizontal axis of x; it is a scale of values ranging from 0 to 255 in the case of an bit image, or it can have normalized values in the range (0 - 1.0) or even be a scale in percentage (0 - 100%). In the output transfer (the y axis) is represented the number of times (that is, y) a given value x appears. A higher column (y greater) indicates that many pixels have the corresponding value x; a lower column indicates that fewer pixels have that value. On the left we have the minimum value 0, which is the black point. On the right we have the maximum value 1.0 which is the white point. The intermediate values pass smoothly from one extreme to the other. The three important points (including the midtones, i.e. the Master Offset) are indicated by cursors (small triangles) at the base of the histogram. You can adjust them to change the values of the three points if you want.

There are 4 possible histograms in the histogram viewer. The red, green, blue histograms show the input histograms for red, green, blue and multiply them by an input transfer to get the output red, green, blue. Then the output red, green, blue is scaled by an output transfer. The scaled red, green, blue is converted into a value and plotted on the value histogram. The value histogram thus changes depending on the settings for red, green, blue. The value transfers are applied uniformly to R, G, B after their color transfers are applied. Mathematically, it is said that the values of x are linked to the values of y by a transfer function. This function is represented by a line that leaves the values of x and y unchanged, but we can intervene by modifying this line with the cursors.

You need to select which transfer to view by selecting one of the channels on the top of the histogram. You can also choose whether to display the master, i.e. only the values of the luma, or show the Parade, i.e. the three RGB channels. You can switch from one to the other with the two buttons in the upper right corner. The input transfer is defined by a graph overlaid on the histogram; this is a straight line. Video entering the histogram is first plotted on the histogram plot, then it is translated so output values now equal the output values for each input value on the input graph.

After the input transfer, the image is processed by the output transfer. The output transfer is simply a minimum and maximum to scale the input colors to. Input values of 100% are scaled down to the output's maximum. Input values of 0% are scaled up to the output minimum. Input values below 0 are always clamped to 0 and input values above 100% are always clamped to 100%. Click and drag on the output gradient's triangles to change it. It also has textboxes to enter values into.

Enable the Automatic toggle to have the histogram calculate an automatic input transfer for the red, green, and blue but not the value. It does this by scaling the middle 99% of the pixels to take 100% of the histogram width. The number of pixels permitted to pass through is set by the Threshold textbox. A threshold of 0.99 scales the input so 99% of the pixels pass through. Smaller thresholds permit fewer pixels to pass through and make the output look more contrasty. Plot histogram is a checkbox that enables plotting the histogram. Split output is a checkbox that enables a diagonal split showing in the compositor. Reset returns the four curves to their initial state (neutral) as well as the Value/RGB histogram buttons.

The histogram plugin ordinarily applies a value for a single frame. A new feature modifies histogram to show values for a selection of frames. You use several frames in a video that you want to use the average color to determine the color you want the rest of the video to be. When there is a large light or color variation within a range of a few frames, you spend a lot of time correcting each frame when it would be better to just get an average value to use. If you want, then you can make a LUT for that set of frames instead of each frame.

It works by selecting the area on the timeline for which you would like to see the Histogram averaged and then click on the Frames button in the Histogram plugin. The parameters are: Linear to Log slider: frequency in Linear range to Log range; default is 50%, but if you want it to be the same as the Videoscope or Histogram Bezier, set the slider all the way to Log. The variation is by 10% steps. Linear generally represents what the eye sees in the real world. Log is an exponential look where the small numbers are represented more - that is, the leading digit. Frames button: if a Selection is set on the timeline, the number of frames will be calculated and shown in the box next to it. Frame Count box: type in the number of frames you want to be looked at starting at the insert marker or use the up/down counter. Clear Frames icon: reset the frame count to the default value of 0.

A side note: by using a number of frames, you can get a dissolve-like transition effect.

Theory:

A histogram is a bunch of bins (accumulators) that count the number of times a particular pixel channel intensity occurs in an image. Dim are on the left, bright on the right.

The number of bins used depends on the color model bit depth:

Histogram:
256 for rgb8 and 65536 for all others.
Bezier:
256 for rgb8/yuv8 and 65536 for all others.
Scopes:
always uses 65536

All of the bins are scanned when the graph is plotted. What is shown depends on which plugin is used:

Histogram:
was max of the bins in the pixel range, now is the sum
Bezier:
is the max of the bins in the pixel range
Scopes:
is the max of the bins in the pixel range

When the color space and the bin size are the same, all of the values increment the indexed bins. When the color is the result of yuv rgb conversion, the results spread if there are more bins than colors. This is the same effect you see when you turn on smoothing in the vectorscope histogram.

The total pixels for each value is approximately the same, but the max value depends on the color quantization. More colors increment more bins. Fewer colors increment fewer bins. In both cases, the image size has the same number of pixels. The fewer color case increments the used bins, and skips the unused bins. This sums all of the pixels into fewer bins, and the bins have higher values. That is the rgb vs yuv case, fewer vs more bins are used.

To report something more consistent, has been changed the reported value to the sum of the accumulated counts for the bins reporting a pixel bar on the graph. The effect of this is to do this:

1                    
1     1              
000100 3 pixels vs 001000 3 pixels            

On the left, the course color model piles all 3 pixels into one bin. max value 3

On the right, the fine color model puts the counts into 2 bins, max 2, sum 3

So, by reporting the sum the shape of the results are more similar.

The CINELERRA-GG Community, 2021
https://www.cinelerra-gg.org