In the previous recipe, you learned how an image can be segmented into regions by gradually flooding it and creating watersheds. The maximally stable extremal regions (MSER) algorithm uses the same immersion analogy in order to extract meaningful regions in an image. These regions will also be created by flooding the image level by level, but this time, we will be interested in the basins that remain relatively stable for a period of time during the immersion process. It will be observed that these regions correspond to some distinctive parts of the scene objects pictured in the image.
The basic class to compute the MSER of an image is
cv::MSER. An instance of this class can be created by using the default empty constructor. In our case, we chose to initialize it by specifying a minimum and maximum size for the detected regions in order to limit their number. Then, our call will be as follows:
// basic MSER detector cv::MSER mser(5...