# Contrast measurement in black and white

When it comes to measuring certain image parameters, an unpleasant subtlety immediately arises. Man and computer perceive images differently. A person isolates objects from noise, may consider something in low light, and a computer understands a picture as a set of coordinates with corresponding brightnesses. And when a person and a computer are asked about some distinctive features of the image, they will immediately disperse in the testimony. We need to somehow make sure that the conclusions they made are similar.
Consider the methods that are used to analyze the contrast in black and white images, and try to choose something more or less objective.

##### Method one

The method is canonical, from 1977 [1].

Contrast is determined by the ratio of the difference in brightness between the object 1 and background 2 to one of these brightnesses. The range of output values ​​is from 0 to 1.
In fact, it does not show anything. Move on.

##### Second method

It was proposed by domestic scientists in 1979, for the analysis of plot images.
The bottom line is: since the image has a complex plot character, this necessitates, when determining its contrast, to proceed from the contrast of individual combinations of image elements. In this case, all elements are considered equivalent, and the contrast of each pair is calculated by the formula:

where the elements of the numerator and denominator are the brightness of the elements of the plot image. The plot of the image suggests the possibility of its use by humans. Therefore, when evaluating contrast, as one of the parameters of image quality, it is necessary to take into account a number of features of the human visual perception. Next, applying the rule of summing contrasts, a set of values ​​is calculated that determine the perception of each pair of image elements. By averaging the local contrast matrix, a total contrast is obtained [2].
The method is too complicated, will not work.

##### Method three

It is stated in GOST 18862-73 from 1983: The

brightness of the image sections is measured with a candela photometer per square meter, the error is 10%, which is a bit much. And if there is a photometer (I've never seen it live before). In the absence of such, I personally had experience with an oscilloscope:
take a wire where the signal is output (say, composite), a test signal (strip or checkerboard) is fed, an oscillogram is output, and, comparing with the standard for the video signal, the difference is measured, then normalized to the maximum. Accuracy - I think somewhere around 20-25%, which is beyond rationality of use. The range of output values ​​is from 0 to 1. Biased.
Obviously not suitable, move on.

##### Fourth method

Similarly, US federal standard 1037C of 1996:
only states that "contrast is the ratio of the brightness of a certain element of an image (pixel) to the brightness of the rest of the image." It is also worth noting that this standard defines brightness as an immeasurable quantity.
It doesn’t suit us at all. We only note that there is such a thing.

##### Fifth method

It was founded by Vorobel in 1999, it is mentioned on such a solid resource as MATLAB.Exponenta.

Already interesting, because it is normalized in the range of brightness from 0 to 1, and it is very objective.

With the calculation of contrast, there is one subtlety. There are two objects nearby, one has a brightness of 10, the other has 20, we get 0.5 in the first and third methods, and 0.3 in the second. The brightness of 100 and 200, in the first and third methods we get the same 0.5, in the second - again 0.3, but at brightness of 10 and 20, the difference can not be seen.

##### Contrast, in my opinion, is more objective to calculate by the Vorobel method, if the quality is poor and there is a lot of noise, take into account the areas of objects, and from them average the brightness values ​​of objects.

Now let's look at it in action: The

contract comes with three images - the usual one, with an equalized histogram, and the ideal one. The selected areas were analyzed in .bmp format, the brightness range is 0 - 255.

- the contrast of a conventional image is K = 0.67.
- the contrast of the equalized image K = 0.88.
- the contrast of the ideal image is K = 1.

Here is such a story, thank you for your attention!

List of references
1. Yashtold-Govorko V. A. Photographing and processing. Filming, formulas, terms, recipes. Ed. 4th abbr. M., "Art", 1977.
2. Gurov A.A., Porfiryeva N.N. Issues of assessing the contrast of plot images // Transactions of GOI im. S.I. Vavilova. - vol. 44, no. 178. - L. - 1979. - C. 31 - 34.
3. Vorobel R.A. Digital image processing based on the theory of contrast: Dis. Doct. tech. Sciences: 05.13.06. - Lviv, 1999 .-- 369 p.