官术网_书友最值得收藏!

Histogram equalization for contrast enhancement

A very common method of enhancing the contrast of an image is by transforming its pixel values so that its new histogram matches a predefined distribution. MATLAB offers a function for this process called as histeq. The function can also be called with one input, in which case it uses the default target histogram. Let's see what this function does, by writing the following script:

img = imread('my_image.bmp');
img_eq = histeq(img);
subplot(2,2,1),imshow(img),title('Original Image');
subplot(2,2,2),imshow(img_eq),title('Equalized Image');
subplot(2,2,3),imhist(img,64),title('Original Image Histogram');
subplot(2,2,4),imhist(img_eq,64),title('Equalized Image Histogram');

Saving this script as HistogramEqualization.m and typing it in the command line, leads to the following result:

As we can see, the contrast of the image is enhanced and the values are almost evenly spread throughout the range of possible values (0 to 255). This process usually has the effect of enhancing useful details, but also at the same time enhancing unwanted noise. Therefore, this approach should be used cautiously.

主站蜘蛛池模板: 铜鼓县| 鄂托克前旗| 孝义市| 伊春市| 凌海市| 巫溪县| 天峻县| 华安县| 法库县| 桃源县| 郎溪县| 东方市| 麟游县| 鹤山市| 吉林省| 沧州市| 曲麻莱县| 桑日县| 汝阳县| 福清市| 德江县| 岳阳县| 汽车| 凯里市| 伊通| 佳木斯市| 凉山| 汉寿县| 河源市| 衢州市| 湖南省| 叙永县| 扎囊县| 普兰县| 宣武区| 福海县| 咸宁市| 郑州市| 吉林市| 大理市| 扎兰屯市|