java Android 中的膨胀和腐蚀
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12435756/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Dilation and erosion in Android
提问by Hua Er Lim
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.
我不确定是否cvSmooth
需要使用。
回答by Rui Marques
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:
Android 具有与 C++/Python 文档相同的功能,因此您需要做的就是找到它们属于哪个类,在本例中为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)));
回答by remi
You do have erosionand dilationin 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.
你在 OpenCV 中确实有腐蚀和膨胀。您正在寻找的“弥合差距”可能是所谓的闭包,即膨胀后腐蚀。可以使用对morphologyEx 函数的单个调用来完成。它可能是一个“开口”,具体取决于您是要侵蚀白色部分还是黑色部分。