2016-12-28 131 views
3

我也想在EmguCV 3.1.0.2504中畫一個輪廓,但是我得到錯誤:「OpenCV:i < 0。孩子無法評估。」在emgucv中繪製輪廓3.1

IInputArrayOfArrays biggestCnt = GetBiggestCountour(BinaryImage); 
Image<Gray, byte> justCountor = new Image<Gray, byte>(384, 284, new Gray(255)); 
CvInvoke.DrawContours(justCountor, biggestCnt, -1, new MCvScalar(255, 0, 0)); 

enter image description here

+0

通常我會看到這個錯誤,當我列出一個無法評估爲有形的列表時。 GetBiggestCountour()做什麼?你可以發佈嗎? – Woot

+0

@Woot GetBiggestCountour()返回圖像的最大輪廓。我在圖像中顯示了輸出。 –

回答

1

我改線:

CvInvoke.DrawContours(justCountor, biggestCnt, -1, new MCvScalar(255, 0, 0)); 

justCountor.Draw(biggestCnt.ToArray(), new Gray(0), 1); 

和問題就解決了。

+0

這似乎是一個系統性問題....有許多方法在輸入符合要求時似乎會引發奇怪的錯誤。 –