本文需要参考的内容:
- cv2.threshold 请参考:https://blog.csdn.net/weixin_42296411/article/details/80901080
- cv2.findContours 请参考:https://blog.csdn.net/Easen_Yu/article/details/89365497
具体内容如下:
图片内容
step1
import cv2
import numpy as np
img = cv2.imread('binary_img.jpeg',0) # 0代表以灰度模式读入图片
print('img\'s shape is: {}'.format(img.shape))
cv2.imshow('raw',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
显示结果如下:
img's shape is: (158, 230)
step 2
retval, dst = cv2.threshold