|
@@ -69,6 +69,8 @@ class FrontSideAnchor(OcrAnchor):
|
|
return True
|
|
return True
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
+ def locate_anchor(self, res, is_horizontal) -> int:
|
|
|
|
+ return super(FrontSideAnchor, self).locate_anchor(res, is_horizontal)
|
|
|
|
|
|
class BackSideAnchor(OcrAnchor):
|
|
class BackSideAnchor(OcrAnchor):
|
|
def __init__(self, name: str):
|
|
def __init__(self, name: str):
|
|
@@ -81,6 +83,9 @@ class BackSideAnchor(OcrAnchor):
|
|
return True
|
|
return True
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
+ def locate_anchor(self, res, is_horizontal) -> int:
|
|
|
|
+ return super(BackSideAnchor, self).locate_anchor(res, is_horizontal)
|
|
|
|
+
|
|
|
|
|
|
def detect_angle(result, ocr_anchor: OcrAnchor):
|
|
def detect_angle(result, ocr_anchor: OcrAnchor):
|
|
lp = LineParser(result)
|
|
lp = LineParser(result)
|
|
@@ -113,7 +118,7 @@ class AngleDetector(object):
|
|
result = self.ocr.ocr(img, cls=True)
|
|
result = self.ocr.ocr(img, cls=True)
|
|
angle = detect_angle(result, ocr_anchor)
|
|
angle = detect_angle(result, ocr_anchor)
|
|
# 旋转90度之后要重新计算角度
|
|
# 旋转90度之后要重新计算角度
|
|
- return (angle - 1 + 4) / 4, result
|
|
|
|
|
|
+ return (angle - 1 + 4) % 4, result
|
|
|
|
|
|
def _detect_back(self, image):
|
|
def _detect_back(self, image):
|
|
mask = np.zeros(image.shape, dtype=np.uint8)
|
|
mask = np.zeros(image.shape, dtype=np.uint8)
|