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

Image analysis

The aim of this section is the extraction of information from images. We are going to focus on two cases:

  • Image structure

  • Object recognition

Image structure

The goal is the representation of the contents of an image using simple structures. We focus on one case alone: image segmentation. We encourage the reader to explore other settings, such as quadtree decompositions.

Segmentation is a method to represent an image by partition into multiple objects (segments); each of them sharing some common property.

In the case of binary images, we can accomplish this by a process of labeling, as we have shown in a previous section. Let's revisit that technique with an artificial image composed by 30 random disks placed on a 64 x 64 canvas:

In [1]: import numpy as np, matplotlib.pyplot as plt
In [2]: from skimage.draw import circle
In [3]: image = np.zeros((64, 64)).astype('bool')
In [4]: for k in range(30):
   ...:     x0, y0 = np.random.randint(64, size=(2))
   ...:     image[circle(x0, y0...