private static void DrawDefects(IplImage img, CvSeq<CvConvexityDefect> defect) { int count = 0; foreach (CvConvexityDefect item in defect) { CvPoint p1 = item.Start, p2 = item.End; double dist = GetDistance(p1, p2); CvPoint2D64f mid = GetMidpoint(p1, p2); img.DrawLine(p1, p2, CvColor.White, 3); img.DrawCircle(item.DepthPoint, 10, CvColor.Green, -1); img.DrawLine(mid, item.DepthPoint, CvColor.White, 1); Console.WriteLine("No:{0} Depth:{1} Dist:{2}", count, item.Depth, dist); count++; } }