# 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 *

        for i in range(len(bound_rects)):
            fRatio = bound_rects[i][2] / bound_rects[i][3]

            if fRatio < 3.0 and fRatio > 1.0 and bound_rects[i][3] < 120:
                itemRect = bound_rects[i]  # [x, y, w, h]

                itemRect[0] = itemRect[0] - itemRect[3] * (4 - fRatio)
                if (itemRect[0] < 0):
                    itemRect[0] = 0

                itemRect[2] = itemRect[2] + itemRect[3] * 2 * (4 - fRatio)

                if (itemRect[2] + itemRect[0] >= src.shape[1]):
                    itemRect[2] = src.shape[1] - itemRect[0]

                itemRect[1] = itemRect[1] - itemRect[3] * 0.08
                itemRect[3] = itemRect[3] * 1.16
                bound_rects_part.append(itemRect)
        rects_sobel = []
        for i in range(len(bound_rects_part)):
            bound_rect = bound_rects_part[i]

            refpoint = (bound_rect[0], bound_rect[1])
            x = int(bound_rect[0] if bound_rect[0] > 0 else 0)
            y = int(bound_rect[1] if bound_rect[1] > 0 else 0)

            width = int(bound_rect[2] if x + bound_rect[2] < src.shape[1] else src.shape[1] - x)
            height = int(bound_rect[3] if y + bound_rect[3] < src.shape[0] else src.shape[0] - y)


# 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 *


        for i in range(len(bound_rects)):
            fRatio = bound_rects[i][2] / bound_rects[i][3]

            if fRatio < 3.0 and fRatio > 1.0 and bound_rects[i][3] < 120:
                itemRect = bound_rects[i]  # [x, y, w, h]

                itemRect[0] = itemRect[0] - itemRect[3] * (4 - fRatio)
                if (itemRect[0] < 0):
                    itemRect[0] = 0

                itemRect[2] = itemRect[2] + itemRect[3] * 2 * (4 - fRatio)

                if (itemRect[2] + itemRect[0] >= src.shape[1]):
                    itemRect[2] = src.shape[1] - itemRect[0]

                itemRect[1] = itemRect[1] - itemRect[3] * 0.08
                itemRect[3] = itemRect[3] * 1.16
                bound_rects_part.append(itemRect)
        rects_sobel = []
        for i in range(len(bound_rects_part)):
            bound_rect = bound_rects_part[i]

            refpoint = (bound_rect[0], bound_rect[1])
            x = int(bound_rect[0] if bound_rect[0] > 0 else 0)
            y = int(bound_rect[1] if bound_rect[1] > 0 else 0)

            width = int(bound_rect[2] if x + bound_rect[2] < src.shape[1] else src.shape[1] - x)
            height = int(bound_rect[3] if y + bound_rect[3] < src.shape[0] else src.shape[0] - y)


            bound_mat = src[y: y + height, x: x + width, :]