def col_profile(num_cols, height):
profile = np.zeros(num_cols)
peak_width = int(math.ceil(num_cols * 0.125))
# average number of pixels should be height
for i in range(0, peak_width):
profile[i] = height
# average number of pixels should be 10% of height
for i in range(peak_width, num_cols - peak_width):
profile[i] = height * .1
# average number of pixels should be height
for i in range(num_cols - peak_width, num_cols):
profile[i] = height
# normalize to between 0 and 1
profile *= 1.0 / profile.max()
return profile
评论列表
文章目录