如何解决当背景位于角色后面时,skimage regionprops不会对角色进行分段
我正在尝试制作ANPLR系统,但是我的车牌示例(以及我国的很多车牌)在车牌字符后面都有一定的背景,这是一个示例,
在创建了threshold_otsu过滤器之后
threshold_value = threshold_otsu(gray_car_image)
binary_car_image = gray_car_image > threshold_value
和区域道具
for i in range(len(cca2.plate_like_objects)):
license_plate = np.invert(cca2.plate_like_objects[i])
labelled_plate = measure.label(license_plate,background=0,connectivity=1)
fig,ax1 = plt.subplots(1)
ax1.imshow(license_plate,cmap="gray")
character_dimensions = (k1,k2,k3,k4)
min_height,max_height,min_width,max_width = character_dimensions
characters = []
counter=0
column_list = []
for regions in regionprops(labelled_plate):
y0,x0,y1,x1 = regions.bbox[0],regions.bbox[1],regions.bbox[3],regions.bbox[4]
region_height = y1 - y0
region_width = x1 - x0
if region_height > min_height and region_height < max_height and region_width > min_width and region_width < max_width:
roi = license_plate[y0:y1,x0:x1]
rect_border = patches.Rectangle((x0,y1),x1 - x0,y1 - y0,edgecolor="red",linewidth=2,fill=False)
ax1.add_patch(rect_border)
resized_char = resize(roi,(40,80))
characters.append(resized_char)
column_list.append(x0)
plt.show()
我明白了
现在这是我的问题,是否有一个过滤器或某种方法以便使该字符可被regionprops识别?其他选择或建议?
编辑:如果我申请的话,我在这里取得了一些进步,虽然不是很多,但是有些进步
threshold_value = threshold_niblack(gray_car_image)
binary_car_image = gray_car_image > threshold_value
代替threshold_otsu
我获得了另一个字符的识别,但是我在分割中仍然没有“ 2”,任何帮助都将是惊人的,这是盘子
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。