March 2019
Intermediate to advanced
538 pages
13h 38m
English
We achieve this using a morphological gradient. This is the operation that draws the boundary around a shape by taking the difference between the dilation and erosion of an image:

Let's look at the function to perform morphological gradient:
Mat performMorphologicalGradient(Mat inputImage, int morphologyElement, int morphologySize){ Mat outputImage, tempImage1, tempImage2; int morphologyType; if(morphologyElement == 0) morphologyType = MORPH_RECT; else if(morphologyElement == 1) morphologyType = MORPH_CROSS; else if(morphologyElement == 2) morphologyType = MORPH_ELLIPSE; // Create the structuring element for erosion Mat ...Read now
Unlock full access