This repository was archived by the owner on Jul 3, 2023. It is now read-only.
File tree 3 files changed +37
-12
lines changed
3 files changed +37
-12
lines changed Original file line number Diff line number Diff line change 8
8
from codebase .web import APIRequestHandler
9
9
10
10
11
- class NPRHandler (APIRequestHandler ):
11
+ class LPRHandler (APIRequestHandler ):
12
12
13
13
def post (self ):
14
14
"""识别车牌
@@ -18,5 +18,11 @@ def post(self):
18
18
19
19
image = io .imread (url )
20
20
info = HyperLPR_PlateRecogntion (image )
21
- logging .info ("识别车牌:%s" , info )
22
- self .success (data = info )
21
+ if info :
22
+ item = info [0 ]
23
+ logging .info ("识别车牌:%s" , info )
24
+ self .success (data = {"lp" : item [0 ], "precision" : item [1 ], "pos" : item [2 ]})
25
+ return
26
+
27
+ logging .info ("识别失败:%s" , url )
28
+ self .success (status = "unknown" , message = "车牌识别失败" )
Original file line number Diff line number Diff line change 1
1
openapi : ' 3.0.2'
2
2
info :
3
- title : 工作人员小程序端 API
3
+ title : LPR (车牌识别)服务 API
4
4
version : ' 1.0.0'
5
5
description : |
6
6
注意
@@ -10,7 +10,7 @@ servers:
10
10
- url : https://localhost:3000
11
11
description : 本地开发环境
12
12
tags :
13
- - name : npr
13
+ - name : lpr
14
14
description : 车牌识别
15
15
16
16
@@ -24,11 +24,11 @@ paths:
24
24
description : OK
25
25
26
26
27
- " /npr " :
27
+ " /lpr " :
28
28
29
29
post :
30
30
tags :
31
- - npr
31
+ - lpr
32
32
summary : 识别车牌
33
33
requestBody :
34
34
required : true
@@ -50,16 +50,35 @@ paths:
50
50
application/json :
51
51
schema :
52
52
type : object
53
+ required :
54
+ - status
53
55
properties :
54
56
status :
55
57
type : string
56
- description : success
58
+ description : |
59
+ 识别成功返回 `success` ,识别失败返回 `unknown`
60
+ enum :
61
+ - success
62
+ - unknown
57
63
data :
58
64
type : object
65
+ required :
66
+ - lp
67
+ - precision
68
+ description : |
69
+ 如果识别成功,则返回该数值
59
70
properties :
60
- np :
71
+ lp :
61
72
type : string
62
73
description : 车牌
74
+ precision :
75
+ type : number
76
+ description : 精准度
77
+ pos :
78
+ type : array
79
+ description : 坐标
80
+ items :
81
+ type : number
63
82
64
83
65
84
components :
Original file line number Diff line number Diff line change 2
2
3
3
from codebase .controllers import (
4
4
default ,
5
- npr
5
+ lpr
6
6
)
7
7
8
8
15
15
16
16
# NPR
17
17
18
- url (r"/npr " ,
19
- npr . NPRHandler ),
18
+ url (r"/lpr " ,
19
+ lpr . LPRHandler ),
20
20
21
21
]
You can’t perform that action at this time.
0 commit comments