Opencv-如何在高斯模糊之后找到每个轮廓

时间:2020-04-22 16:27:11

标签: opencv opencv-contour

# GaussianBlur
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (7, 7), 0)
edged = cv2.Canny(gray, 50, 200)
edged = cv2.dilate(edged, None, iterations=1)
edged = cv2.erode(edged, None, iterations=1)

# find all Contour, 
cnts = cv2.findContours(edged.copy(), cv2.RETR_LIST,
                        cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)
(cnts, _) = contours.sort_contours(cnts)
pixelsPerMetric = None

picture 1 - I want to find all contours

picture 2 - but result: I can find 1 contour only

如何获得所有轮廓?

0 个答案:

没有答案