HyperLPR源码分析9

本文深入探讨HyperLPR中slidingWindowsEval函数,分析如何找到最佳分割点并进行图像分割。作者使用searchOptimalCuttingPoint找到切割点,随后依据点的位置进行不同方式的裁剪。经过精细修剪的图像段通过refineCrop函数处理后,进行文字识别,得到的confidence和name将被返回。
摘要由CSDN通过智能技术生成

2021SC@SDUSC

我们接着来分析slidingWindowsEval函数

在上一次分析中,我们提到,作者调用了他自己写的函数searchOptimalCuttingPoint,找到了最佳分割点,这个点是一个列表,因为点不止一个,然后点列表和评价点的分割score组成的总体列表,作为res返回原函数中,接下来,作者用cutting_pts = res[1],将点集取出来存放到cutting_pts里面,这样就可以分割了。以下是分割部分的代码:

 for x in range(1,len(cutting_pts)):
        if x != len(cutting_pts)-1 and x!=1:
            section = image[0:36,cutting_pts[x-1]-2:cutting_pts[x]+2]
        elif  x==1:
            c_head = cutting_pts[x - 1]- 2
            if c_head<0:
                c_head=0
            c_tail = cutting_pts[x] + 2
            section = image[0:36, c_head:c_tail]
        elif x==len(cutting_pts)-1:
            end = cutting_pts[x]
            diff = image.shape[1]-end
            c_head = cutting_pts[x - 1]
            c_tail = cutting_pts[x]
            if diff<7 :
           
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值