_, thresh = cv2.threshold(
img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
# 使用cv.RETR_CCOMP尋找輪廓
contours, hierarchy = cv2.findContours(thresh, cv2.RETR_CCOMP, 2)
# 繪制輪廓內(nèi)部
cv2.drawContours(img, contours, i, 255, -1)
文章來源地址http://www.zghlxwxcb.cn/news/detail-714696.html
文章來源:http://www.zghlxwxcb.cn/news/detail-714696.html
到了這里,關(guān)于【opencv】 利用圖像輪廓函數(shù)填充輪廓內(nèi)部的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!