identify contours in a image which are having same color using opencv or javacv?

早过忘川 提交于 2019-12-04 23:17:36

The concept of solution is the same as with previous question - use dilate and erode:

Mat src = imread("input.jpg"), tmp;

cvtColor(src, tmp, CV_BGR2GRAY);
threshold(tmp, tmp, 200, 255, THRESH_OTSU);

Mat element = getStructuringElement(MORPH_RECT, Size(3, 3), Point(1, 1));
dilate(tmp, tmp, element);
erode(tmp, tmp, element);

Result:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!