0
안녕하세요 opencv에서 + + Findcontours
배열 계층 구조를 반환하고 내가 얻을 수있는 구멍의 경계를 얻으려면 계층 구조를 얻을 수 있습니다. emgu cv에서 이러한 경계를 어떻게 얻을 수 있습니까? emgu cv에서 어떻게 구멍을 찾을 수 있습니까?Opencv Findcontour가 Emgu C#에서 다르게 동작하는 이유는 무엇입니까?
안녕하세요 opencv에서 + + Findcontours
배열 계층 구조를 반환하고 내가 얻을 수있는 구멍의 경계를 얻으려면 계층 구조를 얻을 수 있습니다. emgu cv에서 이러한 경계를 어떻게 얻을 수 있습니까? emgu cv에서 어떻게 구멍을 찾을 수 있습니까?Opencv Findcontour가 Emgu C#에서 다르게 동작하는 이유는 무엇입니까?
다음 코드를 사용하여 Emgucv에서 등고선 계층 구조를 얻을 수 있습니다. 상기 기준 여기 사용이 Online Tutor! 들어
Image<Bgr, byte> Img_Result_Bgr = Img_Source_Bgr.Copy();
Image<Gray, byte> Img_Org_Gray = Img_Source_Bgr.Convert<Gray, byte>();
Image<Gray, byte> Img_CannyEdge_Gray = new Image<Gray, byte>(Img_Source_Bgr.Width,Img_Source_Bgr.Height);
Img_CannyEdge_Gray = Img_Org_Gray.Canny(10, 50);
Img_Org_Gray.Dispose();
Random Rnd = new Random();
#region Finding Contours
using (MemStorage storage = new MemStorage()) //allocate storage for contour approximation
for (Contour<Point> contours = Img_CannyEdge_Gray.FindContours(); contours != null; contours = contours.HNext)
{
Contour<Point> currentContour = contours.ApproxPoly(contours.Perimeter * 0.05, storage);//if you want to Approximate the contours into a polygon play with this function().
if (contours.Area > 100) //only consider contours with area greater than 100
{
Img_Result_Bgr.Draw(contours, new Bgr(Rnd.Next(255),Rnd.Next(255),Rnd.Next(255)), 2);
}
}
#endregion
Img_CannyEdge_Gray.Dispose();
imageBox1.Image = Img_Result_Bgr;
이 코드의 출력이다. http://s18.postimg.org/511xwpm15/Forum_Contour.jpg
감사합니다. 감사하지만이 코드가 나를 도울 수있는 이미지의 구멍을 찾고 싶습니다. – user2922251
아니야 내게 바깥 윤곽 만 줄거야 – user2922251
http://i.stack.imgur.com/qLZ6w.png 이 이미지는 내면의 구멍을 찾고 싶습니까 ?? – user2922251