From 5d557801d61beb4970ffc4c62ba81cd0cd76db68 Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@gmail.com> Date: Tue, 11 Jun 2019 17:46:17 +0000 Subject: [PATCH] Angle of page rotation can be determined with c wrapper function. --- aoi_ocr/Ocr.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/aoi_ocr/Ocr.py b/aoi_ocr/Ocr.py index c064e76..842a237 100644 --- a/aoi_ocr/Ocr.py +++ b/aoi_ocr/Ocr.py @@ -4,6 +4,7 @@ import numpy as np import os import pkg_resources +from .rotation_wrapper import get_scan_angle markerfile = '/template-sq.png' # always use slash markerfilename = pkg_resources.resource_filename(__name__, markerfile) @@ -77,6 +78,12 @@ if xpos > self.imgHeight / 2.0 and ypos > self.imgWidth / 2.0: self.rotateAngle(180) + #small rotation check + angle=get_scan_angle(self.filename) + if angle>0.1 or angle<-0.1: + print("Rotating for angle of {}.".format(angle)) + self.rotateAngle(-angle) + def rotateAngle(self, angle=0): # rot_mat = cv2.getRotationMatrix2D( # (self.imgHeight / 2, self.imgWidth / 2), angle, 1.0 -- Gitblit v1.9.3