def CropLowerBoundary(img):
# img_gray = ToGrayImage(path)
_,img_bi = cv2.threshold(img,60,255,cv2.THRESH_BINARY)
threshold_rate = 0.95
threshold_row = -1
row,col = img_bi.shape
for tmp_r in range(row-1,-1,-1):
tmp_sum = sum(img_bi[tmp_r])
rate = float(tmp_sum)/255/col
# print(rate)
if rate>threshold_rate:
threshold_row = tmp_r
break
img = img[0:threshold_row,:]
# plt.imshow(img,"gray")
# plt.show()
return img
FeatureExtraction.py 文件源码
python
阅读 34
收藏 0
点赞 0
评论 0
评论列表
文章目录