Contrast Stretching – License Plate Object Detection Week 1

image-processing object-detection matlab

In this week, simple contrast stretching is implemented as a image enhancement technique to improve the contrast of the image. The target image for this project actually already has pretty good contrast, but for better automation, proper normalization is needed to better generalize this solution.

To preserve the colors, the actual stretching operation is performed using the original color image. However, for statistics analysis, all the data, including minimum, maximum, and standard deviation, is collected based on the grayscale image.

gMin = min(gray(:));
gMax = max(gray(:));
gStd = std(gray(:));
% Apply statistics three-sigma rule to bound to 99.73% of data
gLowerBound = max(gMin, (gMax + gMin) / 2 - gStd * 3);
gUpperbound = min(gMax, (gMax + gMin) / 2 + gStd * 3);
contrastStretched = (image - gLowerBound) / (gUpperbound - gLowerBound);

The distribution of the colors in the target image is assumed to follow the normal distribution. Thus, the statistics three-sigma rule is used in the contrast stretching process to bound to 99.73% of data, and discard 0.27% of the original data. After the stretching, there might be approximately 0.27% of the data going out of bounds (>1 or <0). This is to further improve the normalization effect.


Original Contrast Stretched
Original Contrast Stretched
Original Histgram Contrast Stretched Histgram

From the results we can see that there isn’t a noticeable change in these two images before and after the contrast stretching. But because this project aims to develop a general algorithm that would work on other similar images as well. Contrast stretching, or normalization, is necessary to help make this program more automated.


Next: Week 2: Thresholding

Chen Yumin
Chen Yumin

Hi, my name is Chen Yumin.
I am the author of the stuff you're reading right now.

Latest Project

Connect With Me

Enjoy what you see? Follow me on:


Subscribe via RSS