获得点阵
( point_data, confidence )
| 65 | return img_data |
| 66 | |
| 67 | def create_point( point_data, confidence ): |
| 68 | ''' 获得点阵 ''' |
| 69 | |
| 70 | # 实际操作下,套路不深,x间隔25,y相同,共7个点 ,先模拟意思一下 |
| 71 | points = {1:[ 20.5,25.1875],2:[ 45.5,25.1875],3:[ 70.5,25.1875],4:[ 95.5,25.1875],5:[120.5,25.1875],6:[145.5,25.1875],7:[170.5,25.1875]} |
| 72 | wi = 0 |
| 73 | input_points = [] |
| 74 | |
| 75 | for word in ( point_data['items'][0]['words'] ): |
| 76 | wi = wi+1 |
| 77 | if( word['confidence'] < confidence ): |
| 78 | try: |
| 79 | input_points.append(points[wi]) # 倒置的中文,优图识别不出来,置信度会低于0.5 |
| 80 | except KeyError: |
| 81 | continue |
| 82 | |
| 83 | if( len(input_points) > 2 or len(input_points) == 0 ): |
| 84 | return [] # 7个字中只有2个倒置中文的成功率高 |
| 85 | |
| 86 | result = {} |
| 87 | result['img_size']=[200,44] |
| 88 | result['input_points']=input_points |
| 89 | result = json.dumps(result) |
| 90 | print(result) |
| 91 | return result |
| 92 | |
| 93 | def bolting(k_low,k_hi,k3_confidence): |
| 94 | ''' 筛选把握大的进行验证 ''' |