Hua Er Lim
Hua Er Lim

Reputation: 231

Dilation and erosion in Android

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.

Upvotes: 8

Views: 14955

Answers (2)

Rui Marques
Rui Marques

Reputation: 8914

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)));

Upvotes: 18

remi
remi

Reputation: 3988

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.

Upvotes: 4

Related Questions