What does stand in sharp contrast mean

Since an image is basically a 2-dimensional matrix of numbers (3rd dimension for colors: RGB[A]), it's possible to define a "sharpness" parameter for it, though the perception of it will be subjective.

Sharpness is related to amount and "quickness" of the changes in colour, and can be evaluated executing the Fourier transform (the Fast Fourier Transform is used because it's quicker) over the image.

So you can define the sharpness as the presence of high-frequency content and its intensity. A way to have an indicative evaluation is to pick an horizontal line of pixel and execute the Fourier transform on it.

For instance, if you pick an uncompressed image with only black and white vertical stripes (maximum sharpness):

and pick just an horizontal line, you'll have something like this:

This is the equivalent of a square wave, which transformed looks like:

(image the peaks extending to the infinite, as the edge is virtually instantaneous).

If you smooth the edges, the result will be something like (very approximately):

And the spectrum (again, just indicatively):

As you can see, only the first harmonic (defining the dark and bright areas) has remained equal, while the higher frequency content has strongly decreased. This is the result of smoothing the image, and you can see how a smoother image has less high frequency content. The same applies for "normal" pictures, where increasing the contrast also increases the frequency of changes.


As an evidence, it's also used in JPEG compression to remove the highest frequency content (depending on the quality factor) to reduce the image size.

If I manage to have Matlab working, more detailed examples are coming.