1
我有這個圖片:opencv的findcontours CV_RETR_EXTERNAL不工作
編輯 很抱歉,但我不得不刪除的圖像!
我需要提取非黑畫面的輪廓,所以我用findcontour與CV_RETR_EXTERNAL參數,但我得到這樣的:
下面的代碼:
static Mat canny_output, grey,draw;
vector<vector<Point>> contours;
cvtColor(final_img, grey, CV_BGR2GRAY);
Canny(grey, canny_output, 100, 200);
findContours(canny_output, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
draw = Mat::zeros(canny_output.size(), CV_8UC3);
for (size_t i = 0; i < contours.size(); i++)
{
drawContours(draw, contours, i, Scalar(255, 0, 0));
}
我該怎麼解決?
感謝的人它的工作原理:d – bjorn 2015-04-02 07:54:17