Image histogram modifications (gray-scale images)

Example #1

Load gray-scale image

img = ReadImage["cat256x256.ppm"] ; RowBox[{RowBox[{scale,  , =,  , 1.5}], ;}]

Display image

ShowImage[img, scale] ;

[Graphics:../HTMLFiles/index_63.gif]

Plot image histogram

ShowHistogram[img] ;

[Graphics:../HTMLFiles/index_65.gif]

Histogram equalization of image

tmp = HistogramEqualization[img] ; ShowHistogram[tmp] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_67.gif]

[Graphics:../HTMLFiles/index_68.gif]

Histogram squeeze image

tst = HistogramStretch[img, 0, 50] ; ShowHistogram[tst] ; ShowImage[tst, scale] ;

[Graphics:../HTMLFiles/index_70.gif]

[Graphics:../HTMLFiles/index_71.gif]

Histogram stretch of histogram-squeezed image

tmp = HistogramStretch[tst, 0, 255] ; ShowHistogram[tmp] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_73.gif]

[Graphics:../HTMLFiles/index_74.gif]

Histogram equalization of histogram-squeezed image

tmp = HistogramEqualization[tst] ; ShowHistogram[tmp] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_76.gif]

[Graphics:../HTMLFiles/index_77.gif]

Example #2

Load gray-scale image

img = ReadImage["bakery256x256.ppm"] ; RowBox[{RowBox[{scale,  , =,  , 1.5}], ;}]

Display image

ShowImage[img, scale] ;

[Graphics:../HTMLFiles/index_80.gif]

Plot image histogram

ShowHistogram[img] ;

[Graphics:../HTMLFiles/index_82.gif]

Histogram equalization of image

tmp = HistogramEqualization[img] ; ShowHistogram[tmp] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_84.gif]

[Graphics:../HTMLFiles/index_85.gif]

Histogram squeeze image

tst = HistogramStretch[img, 0, 50] ; ShowHistogram[tst] ; ShowImage[tst, scale] ;

[Graphics:../HTMLFiles/index_87.gif]

[Graphics:../HTMLFiles/index_88.gif]

Histogram stretch of histogram-squeezed image

tmp = HistogramStretch[tst, 0, 255] ; ShowHistogram[tmp] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_90.gif]

[Graphics:../HTMLFiles/index_91.gif]

Histogram equalization of histogram-squeezed image

tmp = HistogramEqualization[tst] ; ShowHistogram[tmp] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_93.gif]

[Graphics:../HTMLFiles/index_94.gif]


Created by Mathematica  (February 5, 2004)