Grayscale image lighting enhancement
Actualizado 15 Aug 2018
The functions works by substracting a filtered image called the background image from the original image to obtain a corrected version of the latter. The background image contains the illumination gradient and therefore allows the correction of the original picture. The function only works on grayscale images and the user must manually input if the foreground is brighter or darker than the background.
The filters employed are the most simple out there: the minimum and maximum filters. Maximum and minimum filters attribute to each pixel in an image a new value equal to the maximum or minimum value in a neighborhood around that pixel, respectively. Therefore by selecting a neighborhood, or structuring element in this case, which best fits each applycation very good results are obtained.
Here are the lines present in the example in the code. To see the code in action, just download it and then execute the following lines in the path where the function is present:
I = imread('printedtext.png');
SE = strel('rectangle',[150,15]);
I_leveled = imgrayenhance(I,'dark',0.8,SE,true);
BW = imbinarize(I_leveled,0.75);
More information about each of these lines is present in under EXAMPLE in the given code.
Santiago Benito (2023). Grayscale image lighting enhancement (https://www.mathworks.com/matlabcentral/fileexchange/68495-grayscale-image-lighting-enhancement), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformasWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.