慕丝7291255
您可以通过使用轮廓来解决该问题。im2, contours, hierarchy = cv2.findContours(gray, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)for contour in contours: (x, y, w, h) = cv2.boundingRect(contour) # if h<500: # check the length of verical lines if w<500: # check the length of horizontal lines cv2.fillConvexPoly(gray,contour,0) #fill the contour with black color