November 2018
Intermediate to advanced
492 pages
12h 19m
English
Let us first load a colored RGB image and split it across the color channels to visualize the histograms of pixel values for different color channels:
im = Image.open('../images/cheetah.png')im_r, im_g, im_b, _ = im.split()pylab.style.use('ggplot')pylab.figure(figsize=(15,5))pylab.subplot(121)plot_image(im)pylab.subplot(122)plot_hist(im_r, im_g, im_b)pylab.show()
The following screenshot shows the output of the previous code block. As can be seen, the input cheetah image is a low-contrast image since the color channel histograms are concentrated at a certain range of values (right-skewed), not spread over all possible pixel values:
The contrast stretching operation stretches the over-concentrated gray-levels. ...
Read now
Unlock full access