我在这里的第一篇文章:)
我正在为 c# 使用 emgu.cv,我想获取在 MSER 中检测到的每个区域的周界折线。问题是点的顺序显然是随机的。
这是我的代码:
var img = imgList["Input"].Clone();
VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint();
VectorOfRect bboxes = new VectorOfRect();
MSERDetector detector = new MSERDetector(delta, minArea, maxArea, maxVariation,
minDiversity, maxEvolution, areaThreshold, minMargin, edgeBlurSize);
Random randomColor = new Random();
detector.DetectRegions(img, contours, bboxes);
for (int i = 0; i < contours.Size; i++)
{
CvInvoke.DrawContours(img, contours, i, new MCvScalar(randomColor.Next(255), randomColor.Next(255), randomColor.Next(255)));
}