2014-06-21 1 views
-2

EmguCV에서 윤곽선을 감싸는 최소 원을 그리는 방법은 무엇입니까? FindContours() 메서드는 일련의 점을 반환합니다. 그러나 원을 그리기 위해 pointf를 묻습니다. 이 문제를 해결할만한 방법이 있습니까? 감사.EmguCV에서 윤곽선을 감싸는 최소 원을 그립니다.

+0

http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html : 당신은이 같은 PointF의 배열로 윤곽을 변환해야합니다 – Haris

답변

0

예, 방법이 있습니다.

for (var contour = binaryImage.FindContours(CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE, 
    RETR_TYPE.CV_RETR_CCOMP, mem); 
    contour != null; 
    contour = contour.HNext) 
    { 
     //assuming you have a way of getting the index of 
     //point you wanted to extract from the current contour 
     var index = 0; 
     PointF[] pointfs = Array.ConvertAll(contour.ToArray(), 
      input => new PointF(input.X, input.Y)); 

     //just an example 
     var circle = new CircleF(pointfs[index], 2.0f); 
    } 
관련 문제