def _remove_line_(self, img):
# ??????
newimg = np.zeros(img.shape, np.uint8)
newimg = cv2.resize(newimg, (img.shape[1], img.shape[0] - top - bottom), interpolation=cv2.INTER_CUBIC)
for i in range(7, 20):
for j in range(img.shape[1]):
newimg[i - top, j] = img[i, j]
# ???????
line = []
for i in range(newimg.shape[0]):
hasline = False
if newimg[i, 0] < 100:
line.append(i)
hasline = True
for j in range(newimg.shape[1]):
if hasline:
newimg[i, j] = 0
else:
if newimg[i, j] < 100:
newimg[i, j] = 255
else:
newimg[i, j] = 0
# top 7 left 7-10 bottom 10
return newimg
评论列表
文章目录