開放-CV 2.4的Android的Java:的Android的Java OpenCV的2.4凸形輪廓convexdefect
...我已經尋找輪廓(MatofPoint列表)是這樣的:
Imgproc.findContours(roi_mat, contours, hierarchy, cfg.retMode, cfg.apxMode);
,然後凸形輪廓(有是MatofInt列表)
for (int k=0; k < contours.size(); k++){
Imgproc.convexHull(contours.get(k), hull.get(k));
}
的凸形輪廓想要一個MatofInt但日e drawcontours想要一個MatofPoint ..那麼該怎麼做?
THX提前..
編輯:@ OpenCV4Android
for (int k=0; k < contours.size(); k++){
Imgproc.convexHull(contours.get(k), hullInt);
for(int j=0; j < hullInt.toList().size(); j++){
hullPointList.add(contours.get(k).toList().get(hullInt.toList().get(j)));
}
hullPointMat.fromList(hullPointList);
hullPoints.add(hullPointMat);
}
Imgproc.drawContours(mROI, hullPoints, -1, new Scalar(255,0,0, 255), 1);
確定THX。我會嘗試,讓你知道.. – ddd
以及我已經嘗試過這樣(編輯問題): 我不知道如果它完全正確,因爲我沒有得到好的結果..大部分時間有很多紅色的凸包線穿過img .. – ddd
或者是因爲findcontour(我試過一個canny和/或門限和gauss過濾器在findcontour之前) – ddd