1
私はfindContours()
とdrawContours()
メソッドを使用して、私のバイナリイメージの輪郭を探しています。ネストされた輪郭が見つかりません
矩形がぼやけますなどのIさらなる閾値私の画像は、次いで、内側が表示されている場合(外側および内側曲線が左下にマージされる注意):
しかしながら、これは私の出力でありますこれを解決する方法を教えてください。続き
は私のコードスニペットです:
void cb_thresh(int,void*)
{vector< vector<Point> > contours;
vector<Vec4i> hierarchy;
threshold(src, thr,threshval, 255,THRESH_BINARY);
namedWindow("threshold",CV_WINDOW_NORMAL);
imshow("threshold",thr);
findContours(thr, contours, hierarchy,CV_RETR_LIST, CV_CHAIN_APPROX_NONE); // Find the contours in the image
Scalar color(255,255,255);
for(int i = 0; i< contours.size(); i++) // iterate through each contour
{
drawContours(thr, contours,i, color, CV_FILLED, 8, hierarchy);
}
namedWindow("dst",CV_WINDOW_NORMAL);
imshow("dst",thr);
}
は、私が輪郭の階層を削除した通知を行います。
私は輪郭抽出方法を変更しようとしましたが、4つの検索方法すべてで同じ出力を得ました。 –
希望の出力は何ですか? – Micka