Book Image

IPython Interactive Computing and Visualization Cookbook

By : Cyrille Rossant
Book Image

IPython Interactive Computing and Visualization Cookbook

By: Cyrille Rossant

Overview of this book

Table of Contents (22 chapters)
IPython Interactive Computing and Visualization Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Manipulating the exposure of an image


The exposure of an image tells us whether the image is too dark, too light, or balanced. It can be measured with a histogram of the intensity values of all pixels. Improving the exposure of an image is a basic image-editing operation. As we will see in this recipe, that can be done easily with scikit-image.

Getting ready

You need scikit-image for this recipe. You will find the installation instructions at http://scikit-image.org/download.html. With Anaconda, you can just type conda install scikit-image in a terminal.

You also need to download the Beach dataset from the book's GitHub repository at https://github.com/ipython-books/cookbook-data.

How to do it...

  1. Let's import the packages:

    In [1]: import numpy as np
            import matplotlib.pyplot as plt
            import skimage.exposure as skie
            %matplotlib inline
  2. We open an image with matplotlib. We only take a single RGB component to have a grayscale image (there are better ways to convert a colored image...