怎么样?
morphologyEx(grey,grey,MORPH_CLOSE,getStructuringElement(MORPH_ELLIPSE,Size(7,7)));
虽然轮廓被合并为左手
编辑:更多的参与略有
Mat tmp=grey.clone();
morphologyEx(tmp,tmp,MORPH_GRADIENT,getStructuringElement(MORPH_ELLIPSE,Size(3,3)));
bitwise_not(tmp,tmp);
Mat smallholes=Mat::zeros(tmp.size(), CV_8UC1);
vector<vector<Point>> contours;
findContours(tmp,contours,CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE);
for(int i = 0; i < contours.size(); i++)
{
double area = contourArea(Mat(contours[i]));
if(area<100)
drawContours(smallholes, contours, i, 255, -1);
}
Mat done;
bitwise_or(grey,smallholes,done);
morphologyEx(done,done,MORPH_CLOSE,getStructuringElement(MORPH_ELLIPSE,Size(3,3)));
这极大地工作!非常感谢你。目前我正试图平滑晒黑后的锐利边缘,正如我在第二次截屏中提到的那样。任何建议都一样吗? – 2013-04-10 08:21:26
怎么样http://stackoverflow.com/questions/7644996/how-to-increase-contours-precision?我还没有亲自尝试过,但它似乎至少有一个人工作 – 2013-04-10 09:41:18
@AnjumShrimali你做了什么边缘平滑? – 2015-12-16 12:55:35