![]() |
Visual Servoing Platform
version 3.5.1 under development (2023-03-14)
|
While the ViSP library is not intended to be an image processing library or replace a raster graphics editor, some easy image processing techniques can be used to improve or adjust the brightness and the contrast of an image.
The different techniques used in this tutorial are:
The following example also available in tutorial-brightness-adjustment.cpp will demonstrate on a real underexposed photo the result of each of these methods:
These functions are provided in a vp:: namespace and accessible using this include:
The brightness and the contrast of an image can be adjusted using a linear function:
The value will behave as a gain factor and the
value as an offset.
The code to use is straightforward:
The result image is the following:
Gamma correction is a simple technique allowing to correct an image using a non-linear operation. The formula used is:
The image below shows in x the input pixel values and in y the output pixel values as they would be transformed by a gamma correction function according to different gamma values.
The result image is the following:
Histogram equalization is an image processing method that will adjust the contrast of an image by stretching or shrinking the intensity distribution in order to have a linear cumulative histogram distribution.
In the next figure, you can observe the histogram for the original underexposed photo where most of the pixel intensities are located in the [0, 30] range. The cumulative histogram distribution has a strong slope for very low pixel intensities.
The histogram for the equalized photo is displayed in the next figure. This time, the bins are spread more uniformally along the intensity range and the cumulative histogram distribution presents a more linear shape.
The result of the histogram equalized image is displayed below:
The Retinex algorithm implemented is ported from the Retinex ImageJ plugin:
Retinex filtering is based on Land's theory of image perception, proposed to explain the perceived colour constancy of objects under varying illumination conditions. Several approaches exist to implement the retinex principles, among these the multiscale retinex with colour restoration algorithm (MSRCR) combines colour constancy with local contrast enhancement so images are rendered similarly to how human vision is believed to operate.
The original photo after the Retinex processing:
You can now read the Tutorial: Contrast and image sharpening techniques, for additional contrast and sharpness improvement techniques.