def FindLowerBoundary(path,mode):
img_gray = ToGrayImage(path)
_,img_bi = cv2.threshold(img_gray,10,255,cv2.THRESH_BINARY)
threshold_rate = 0.8
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
if rate>threshold_rate:
threshold_row = tmp_r
break
return threshold_row
# GrayScale Image Convertor
# https://extr3metech.wordpress.com
BoundaryExtraction.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录