Morphological filters can also be used to detect specific features in an image. In this recipe, we will learn how to detect contours and corners in a gray-level image.
Detecting edges and corners using morphological filters
Getting ready
In this recipe, the following image will be used:
Let's start with our recipe.
How to do it...
Let's have a look at the following code:
- The edges of an image to be detected can be extracted by using the appropriate filter of the cv::morphologyEx function. Refer to the following code:
// Get the gradient image using a 3x3 structuring...