当背景位于角色后面时,skimage regionprops不会对角色进行分段

问题描述

我正在尝试制作ANPLR系统,但是我的车牌示例(以及我国的很多车牌)在车牌字符后面都有一定的背景,这是一个示例,

original plate

在创建了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()

我明白了

enter image description here

现在这是我的问题,是否有一个过滤器或某种方法以便使该字符可被regionprops识别?其他选择或建议?

编辑:如果我申请的话,我在这里取得了一些进步,虽然不是很多,但是有些进步

threshold_value = threshold_niblack(gray_car_image)
binary_car_image = gray_car_image > threshold_value

代替threshold_otsu

我获得了另一个字符的识别,但是我在分割中仍然没有“ 2”,任何帮助都将是惊人的,这是盘子

another char

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...