According to my research,dilation and erosion can be used to bridge the gap for a image after binarize the image.
I not sure if cvSmooth
needs to be used or not.
Dilation adds pixels to the boundaries of objects in an image, while erosion removes pixels on object boundaries. The number of pixels added or removed from the objects in an image depends on the size and shape of the structuring element used to process the image.
Erosion and Dilation are morphological image processing operations. OpenCV morphological image processing is a procedure for modifying the geometric structure in the image. In morphism, we find the shape and size or structure of an object.
Erosion removes pixels on object boundaries. In other words, it shrinks the foreground objects. Enlarge foreground holes. Like in Image Processing Kernels, a larger size of the Structure Element, the effect of Erosion increase.
Android has mostly the same functions has the documented C++/Python, so all you need to do is find which class they belong to, in this case, Imgproc:
Imgproc.erode(mInput, mInput, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2,2)));
Imgproc.dilate(mInput, mInput, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2, 2)));
You do have erosion and dilation in OpenCV. What you are looking for to "brige the gap" is probably what is called a closure, i.e. a dilatation followed by an erosion. It can be done using a single call to morphologyEx function. It could be an "opening", depending if you want to erode the white or black parts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With