# Path: lib/easypr/base.py
# class Plate(object):
#     def __init__(self):
#         self.bColored = True
# 
#     @property
#     def plate_image(self):
#         return self.__plate_image
# 
#     @plate_image.setter
#     def plate_image(self, plate):
#         self.__plate_image = plate
# 
#     @property
#     def plate_pos(self):
#         return self.__plate_pos
# 
#     @plate_pos.setter
#     def plate_pos(self, param):
#         self.__plate_pos = param
# 
#     @property
#     def plate_str(self):
#         return self.__plate_str
# 
#     @plate_str.setter
#     def plate_str(self, param):
#         self.__plate_str = param
# 
#     @property
#     def plate_type(self):
#         return self.__plate_type
# 
#     @plate_type.setter
#     def plate_type(self, param):
#         self.__plate_type = param


import cv2
        import math
from .base import Plate
from .core_func import *
                roi_ref_center = (roi_rect[0][0] - x, roi_rect[0][1] - y)

                if (-3 < roi_angle < 3) or roi_angle == 90 or roi_angle == -90:
                    deskew_mat = bound_mat
                else:
                    # TODO test
                    rotated_mat, flag = self.rotation(bound_mat, roi_rect_size, roi_ref_center,
                                                      roi_angle)
                    if not flag:
                        continue

                    rotated_mat_b, flag = self.rotation(bound_mat_b, roi_rect_size, roi_ref_center,
                                                        roi_angle)
                    if not flag:
                        continue

                    roi_slope, flag = self.isdeflection(rotated_mat_b, roi_angle)
                    if flag:
                        deskew_mat = self.affine(rotated_mat, roi_slope)
                    else:
                        deskew_mat = rotated_mat

                self.DeleteNotArea(deskew_mat)

                if (deskew_mat.shape[1] / deskew_mat.shape[0]) > 2.3 and (
                            deskew_mat.shape[1] / deskew_mat.shape[0]) < 6:
                    if deskew_mat.shape[0] >= 36 or deskew_mat.shape[1] >= 136:
                        plate_mat = cv2.resize(deskew_mat, (136, 36), interpolation=cv2.INTER_AREA)
                    else:
                        plate_mat = cv2.resize(deskew_mat, (136, 36), interpolation=cv2.INTER_CUBIC)

# Path: lib/easypr/base.py
# class Plate(object):
#     def __init__(self):
#         self.bColored = True
# 
#     @property
#     def plate_image(self):
#         return self.__plate_image
# 
#     @plate_image.setter
#     def plate_image(self, plate):
#         self.__plate_image = plate
# 
#     @property
#     def plate_pos(self):
#         return self.__plate_pos
# 
#     @plate_pos.setter
#     def plate_pos(self, param):
#         self.__plate_pos = param
# 
#     @property
#     def plate_str(self):
#         return self.__plate_str
# 
#     @plate_str.setter
#     def plate_str(self, param):
#         self.__plate_str = param
# 
#     @property
#     def plate_type(self):
#         return self.__plate_type
# 
#     @plate_type.setter
#     def plate_type(self, param):
#         self.__plate_type = param


# Path: lib/easypr/plate_locate.py
import cv2
        import math
from .base import Plate
from .core_func import *

                roi_ref_center = (roi_rect[0][0] - x, roi_rect[0][1] - y)

                if (-3 < roi_angle < 3) or roi_angle == 90 or roi_angle == -90:
                    deskew_mat = bound_mat
                else:
                    # TODO test
                    rotated_mat, flag = self.rotation(bound_mat, roi_rect_size, roi_ref_center,
                                                      roi_angle)
                    if not flag:
                        continue

                    rotated_mat_b, flag = self.rotation(bound_mat_b, roi_rect_size, roi_ref_center,
                                                        roi_angle)
                    if not flag:
                        continue

                    roi_slope, flag = self.isdeflection(rotated_mat_b, roi_angle)
                    if flag:
                        deskew_mat = self.affine(rotated_mat, roi_slope)
                    else:
                        deskew_mat = rotated_mat

                self.DeleteNotArea(deskew_mat)

                if (deskew_mat.shape[1] / deskew_mat.shape[0]) > 2.3 and (
                            deskew_mat.shape[1] / deskew_mat.shape[0]) < 6:
                    if deskew_mat.shape[0] >= 36 or deskew_mat.shape[1] >= 136:
                        plate_mat = cv2.resize(deskew_mat, (136, 36), interpolation=cv2.INTER_AREA)
                    else:
                        plate_mat = cv2.resize(deskew_mat, (136, 36), interpolation=cv2.INTER_CUBIC)

                    plate = Plate()