private List <ResultCircles> GetBiggestCircles(List <PolygonCountour> polygonList) { return(polygonList.OrderByDescending(x => x.Size) .Take(NumberOfTriangles) .Select((polygonCountour, index) => new ResultCircles { Size = polygonCountour.Size, Circle = TriangleProcessor.GetMiddle(polygonCountour.Countour), Index = index + 1, LabelPosition = TriangleProcessor.TriangleCenter(polygonCountour.Countour) }).ToList()); }
public List <ResultCircles> FindTriangleContour() { var imgUMat = Treshold().ToUMat(); var contours = new VectorOfVectorOfPoint(); CvInvoke.FindContours(imgUMat, contours, null, RetrType.External, ChainApproxMethod.ChainApproxSimple); var triangleList = TriangleProcessor.GetTriangles(contours); return(GetBiggestCircles(triangleList)); }