findContours函数和drawContours函数是画轮廓很方便的函数
首先贴两张函数参数表,这是C++上的OpenCV
接下来分别看具体用法和参数格式
1. findContours
contours, hierarchy = cv2.findContours(
thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE
)
函数作用是画出0-1图thresh的轮廓。两个重要参数的shape
thresh.shape
(911, 911, 1)
contours.shape
*** AttributeError: 'list' object has no attribute 'shape'
len(contours)