Ellipse as structuring element

asked 2014-07-06 06:48:21 -0500

thearduinoguy gravatar image

updated 2014-07-06 07:24:43 -0500

Haris gravatar image

Hello, I was trying to learn object tracking by looking at an existing code. I understand what erosion and dilation. From the following piece of code, I understand that an ellipse is used as structuring element:

erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));
dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));

//morphological closing (removes small holes from the foreground)
dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));
erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));

In this case, we are tracking a circular object. Is it because of that an ellipse is used as structuring element? How do you choose the right structuring element?

edit retag flag offensive close merge delete