Book Image

Mastering OpenCV Android Application Programming

Book Image

Mastering OpenCV Android Application Programming

Overview of this book

Table of Contents (16 chapters)
Mastering OpenCV Android Application Programming
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
6
Working with Image Alignment and Stitching
Index

Contours


We are often required to break down the image into smaller segments to have a more focused view of the object of interest. Say for instance, you have an image with balls from different sports, such as a golf ball, cricket ball, tennis ball, and football. However, you are only interested in analyzing the football. One way of doing this could be by using Hough circles that we looked at in the last section. Another way of doing this is using contour detection to segment the image into smaller parts, with each segment representing a particular ball.

The next step is to choose the segment having the largest area, that is, your football (it is safe to assume that the football would be the largest of all!).

Contours are nothing but connected curves in an image or boundaries of connected components in an image. Contours are often computed using edges in an image, but a subtle difference between edges and contours is that contours are closed, whereas edges can be anything. The concept of edges...