Zhang Li il y a 2 ans
Parent
commit
9e40bcfaec
3 fichiers modifiés avec 4 ajouts et 7 suppressions
  1. 1 1
      core/line_parser.py
  2. 2 2
      core/parser.py
  3. 1 4
      testing/name_test.py

+ 1 - 1
core/line_parser.py

@@ -31,7 +31,7 @@ class OcrResult(object):
         return [r - l, b - t]
 
     @property
-    def ct(self):
+    def center(self):
         l, t = self.lt
         r, b = self.rb
         return [(r + l)/2, (b + t)/2]

+ 2 - 2
core/parser.py

@@ -99,7 +99,7 @@ class FrontParser(Parser):
                 if is_name and len(res) > 1:
                     for k in range(len(self.result[i])):
                         if k == j: continue
-                        p = np.array(res[j].ct) - np.array(res[k].ct)
+                        p = np.array(res[j].center) - np.array(res[k].center)
                         min = math.hypot(p[0], p[1])
                         if min < mini_dis[0]:
                             mini_dis = [min, k]
@@ -140,7 +140,7 @@ class FrontParser(Parser):
                 if '族' in txt and len(txt) < 3:
                     for k in range(len(self.result[i])):
                         if k == j: continue
-                        p = np.array(res[j].ct) - np.array(res[k].ct)
+                        p = np.array(res[j].center) - np.array(res[k].center)
                         min = math.hypot(p[0], p[1])
                         if min < mini_dis[0]:
                             mini_dis = [min, k]

+ 1 - 4
testing/name_test.py

@@ -6,7 +6,7 @@ import requests
 
 
 
-url = 'http://192.168.199.107:18080'
+url = 'http://192.168.199.208:18081'
 
 
 def send_request(image_path, image_type):
@@ -24,9 +24,6 @@ class TestIdCardAddress(unittest.TestCase):
         r = send_request(image_path, '0')
         self.assertEqual(name, r['result']['name']['text'], f'{image_path} name case error')
 
-    def test_01(self):
-        image_path = '../images/false/miss_id/01.jpg'
-        self._helper(image_path, '52213019970701363x')
 
     def test_01(self):
         image_path = '../images/false/miss_name/01.jpg'