Reputation: 31
If one erodes an image by zeros(3,3) structuring element, it should be all 1s, but in case of OpenCV, it returns the image. Similarly, dilation of image by zeros(3,3) structuring element return image itself instead of all 0s.
Upvotes: 0
Views: 671
Reputation: 5364
The documentation says:
- element – structuring element used for dilation; if
element=Mat()
, a 3x3 rectangular structuring element is used
If you take a look at the implementation, you will see that in case of empty kernel the ksize
will be 3x3 inside of morphOp()
#1683:
Size ksize = !kernel.empty() ? kernel.size() : Size(3,3);
This one also works for me:
cv::Mat input = cv::Mat::eye(10, 10, CV_8UC1);
cv::Mat output;
cv::erode(input, output, cv::Mat());
Upvotes: 2