Pixels store values. Values themselves are good features of an image—they can tell you about image statistics, but almost nothing more. Values group together according to image content—dark to light transitions form borders, and borders divide scenes into different objects. Borders connect together and reveal contours. Contours play an important role in many computer vision algorithms. They help to find objects, to separate one instance of something from another, and finally, to understand the whole scene.
This chapter sheds light on everything relevant to the contours in OpenCV. We will discuss methods for finding, using, and displaying them, as well as consider basic segmentation methods.