Chapter 4. What's in the Image? Segmentation
Segmentation is any process that partitions an image into multiple regions or segments. These will typically correspond to meaningful regions or objects, such as face, car, road, sky, grass, and so on. Segmentation is one of the most important stages in a computer vision system. In OpenCV, there is no specific module for segmentation, though a number of ready-to-use methods are available in other modules (most of them in imgproc
). In this chapter, we will cover the most important and frequently used methods available in the library. In some cases, additional processing will have to be added to improve the results or obtain seeds (this refers to rough segments that allow an algorithm to perform a complete segmentation). In this chapter we will look at the following major segmentation methods: thresholding, contours and connected components, flood filling, watershed segmentation, and the GrabCut algorithm.