Brightness & Contrast


These two functions show the levels of the image directly and in a cumulative way. The cumulative histogram is useful to appreciate equalization and the kind of distribution the image has.

A histogram for a greyscale image is calculated by summing up the number of all pixels which have the same brightness value and plotting the result in a diagram. Thus, for a standard 8bit (256 levels) image there are 256 columns with the extremities representing one black and one white.

For a color image three histograms are calculated for the Red, Green and Blue components. PRICE displays the result in a single diagram by stacking the results of the color on each color: this way the total height of a column is the equivalent of the brightness in the equivalent greyscale image.

Histograms can give an idea of how the brightness of an image is distributed. A high-key image can be distinguished easily from a low-key one.

Since missing grey levels result in a 0 height bar, a histogram can also give a quick view about how good an imaged is quantized. Or if we are looking at the acquisition of a drawing we can see spurious grey levels.

The information a histogram can give are really countless!

Histogram (almost perfect) of a greyscale gradient in an RGB image. Except the spike all levels are equal (a uniform gradient) and the thee RGB components are always equal, meaning they represent grey.

Cumulative Histogram

A cumulative historgam is the integral version of a normal histogram. It represents, level for level, the probability to find a pixel that has up to that brightness. So the curve will always start with zero and end with one! (of course one, since if we accept any level we will find for sure one pixel...) The smoothness and the form of the curve gives us an indication on how uniformly the greylevels are distributed. A uniformly distributed image has a stright line, as an image that has been equalized.
For color image the same kind of representation apply as for normal histograms, being the values of the three RGB components piled in the single bars.
Possible quantization problems which show as missing bars in a normal histogram show up as 'steps' in the curve. Of course this evaluation cannot be always applied, since it depends on the kind of image.

The cumulative version of the uniform greyscale gradient shown already as a picture in the standard histogram.
The three components are equal as expected and since it is a uniform gradient the total luminosity is a stright line starting from 0 and ending at 1.


Equalize the levels of the image shaping them to form an uniform distribution. This can enhance hidden details, but the result can often look artificial.


This filter is highly non-linear and can be used to remove noise while preserving the sharpness of the borders. More specifically, the filter removes pixels that are out-of context. The number of wrong pixels that can be corrected depends on the size fo the filter. For a horizontal window, the size is 2N+1 where N is the number of errors that can be corrected. That is a window large 3 corrects random errors of 1 pixel.
The filter works by reading the pixels in an array, sorting the elements and take the median element as final value. Since we are working in 2D, not only rectangular, single-pixel wide windows are possible (vertical or horizontal) but a cross or a square box can be useful too. The cross has the nice property of leaving the corners intact, while the box filter smoothes them off. Box and Cross filters can be calculated in a separable way: instead of treating all the pixel of the window the same way and sorting them, the median is calculated first horizontally and then results are reprocessed evrtically to obtain a single value. A box separable filter can often be more gentle to the edges than a normal box filter, but its de-noising power is weaker.

Original Image
Horizontal, 3pix wide
Horizontal, 5pix wide
Horizontal, 7pix wide
Horizontal, 3pix wide
Horizontal, 5pix wide
Horizontal, 7pix wide
Cross, 5pix wide
Box, 3x3pix
Box, 3x3pix separable
Box, 5x5pix
Box, 5x5pix separable
Box, 7x7pix
Box, 7x7pix separable

Trace Edges

Tries to extract the edges of the image. It can display the result of the filter directly or it can try to threshold the result to extract the features in a black&white image.

Custom Trace Edges

The custom edge tracer works by combining the effects of the Median filter and the Trace edges one. The basic concept is that the median filter removes noise but preserves the postion of the edges and thus preprocessing the image with a median filter before attempting to trace the edges may prove useful. So to understand better the options and the working of the Median filter, read its description first.
This filter tries to make a step further: it can process the same image up to 3 times independently with different median filters, trace the edge on all those images and then combine the result in a single image. The resulting image is greyscale and every pixel takes in account the result of the trace operations on the intermediate images: when all 3 images are used, if the pixel is black all thre efilters found an edge in that point, if it is dark grey two images out of three had an edge there and if light grey only one out of three. If only two images are used then only two possible leves exist: black and grey. A single filter can be used too and in that case the custo edge tracer acts like the serial application of a median filter and a standard edge tracer. This can be useful to test the effect of the single settings before combining them together.
Different stategies are possible. A first strategy may consist by applying differently shaped mnedian filers to the same images, say one horizontal and one vertical.
Another very interesting approach is to apply a median filter of the same form, but increase its size progresisvely. Thus the resulting image shows the edges at a prorgessive elimination of small details, marking stronger the big edges, but retaining in grey the features that a single application of a strong median filter would have lost.

horizontal median filter only, 3 pix large.
Laplacian (4) detector applied, zero corssing, threshold = 0.12
vertical median filter only, 3 pix large.
Laplacian (4) detector applied, zero corssing, threshold = 0.12

horizontal and vertical median filter, 3 pix large.
Laplacian (4) detector applied, zero corssing, threshold = 0.12

The common parts of the above filters are black, the others are grey.