def contour_plot_on_text_in_image(inv_img):
kernel = cv2.getStructuringElement(cv2.MORPH_CROSS, (5, 2))
dilated = cv2.dilate(inv_img, kernel, iterations=7) # dilate
_, contours, hierarchy = cv2.findContours(
dilated,
cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_NONE) # get contours
return contours
评论列表
文章目录