Chapter 12. Image Analysis

Overview

In the preceding chapter, we learned about the image transformations that OpenCV makes available to us. These transformations were essentially mappings that converted an input image into an output image such that the output remained, essentially, a picture, just like the input. In this chapter we will consider operations that render images into some potentially entirely different representation.

These new representations will usually still be arrays of values, but those values might be quite different in meaning than the intensity values in the input image. For example, the first function we will consider is the discrete Fourier transform, in which the output “image,” though still an array, contains a frequency representation of the input image. In a few cases, the result of the transformation will be something like a list of components, and not an array at all, as would be the case for the Hough line transform.

Finally, we will learn about image segmentation methods that can be used to represent an image in terms of meaningfully connected regions.

Discrete Fourier Transform

For any set of values that are indexed by a discrete (integer) parameter, it is possible to define a discrete Fourier transform (DFT)1 in a manner analogous to the Fourier transform of a continuous function. For N complex numbers x0, x1, x2, ..., xN –1, the one-dimensional DFT is defined by the following formula (where ):

A similar transform can be defined for a two-dimensional ...

Get Learning OpenCV 3 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.