Book Image

Mastering SciPy

By : Francisco Javier Blanco-Silva, Francisco Javier B Silva
Book Image

Mastering SciPy

By: Francisco Javier Blanco-Silva, Francisco Javier B Silva

Overview of this book

Table of Contents (16 chapters)
Mastering SciPy
About the Author
About the Reviewers

Digital images

The dictionary defines a pixel (an abbreviation of picture element) as a minute area of illumination on a display screen, one of many from which an image is composed. We therefore consider a digital image as a set of pixels, each of them defined by its location (irrespective of the kind of coordinates chosen) and the intensity of light of the corresponding image at that location.

Depending on the way we measure intensity, a digital image belongs to one of three possible types:

  • Binary

  • Gray-scale

  • Color (with or without an alpha channel)


In a binary image there are only two possible intensities—light or dark. Such images are traditionally best implemented as simple two-dimensional Boolean arrays. True indicates a bright spot, while False measures a dark spot.

For instance, to create a binary image of size 128 x 128, with a single disk of radius 6 centered at the location (30, 100), we could issue the following:

In [1]: import numpy as np, matplotlib.pyplot as plt
In [2]: disk...