Processing the image dataset

The image set used in this chapter is the Caltech-256 obtained from the Computational Vision Lab at CALTECH. We can download the collection of all 30607 images and 256 categories from the following link:

http://www.vision.caltech.edu/Image_Datasets/Caltech256/

In order to implement the DTW first, we need to extract a time series (pixel sequences) from each image. The time series will have a length of 768 values and will add the 256 values of each color in the RGB (Red, Green, and Blue) color model of each image. The following code implements the Image.open("Image.jpg") function and casts it into an array, and then simply adds the three vectors of color in the list:

from PIL import Image img = Image.open("Image.jpg") ...

Get Practical Data Analysis - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.