# Path: lib/easypr/core_func.py
# def clearLiuDingOnly(img):
# def getPlateType(src, adaptive_minsv):
# def clearLiuDingChar(img):
# def clearLiuDing(mask, top, bottom):
# def ThresholdOtsu(mat):
# def bFindLeftRightBound1(bound_threshold):
# def plateColorJudge(src, r, adaptive_minsv):
# def colorMatch(src, r, adaptive_minsv):
# def bFindLeftRightBound(bound_threshold):
#             H = src_hsv[i, j, 0]
#             S = src_hsv[i, j, 1]
#             V = src_hsv[i, j, 2]


import cv2
import numpy as np
from lib.easypr.core_func import getPlateType, Color, ThresholdOtsu, clearLiuDingChar
            mr = cv2.boundingRect(it)
            x, y, w, h = map(int, mr)

            roi = img_threshold[y:y + h, x:x + w]
            if self.verifyCharSizes(roi):
                vecRect.append(mr)

        if len(vecRect) == 0:
            return 3

        vecRect = sorted(vecRect, key=lambda x: x[0])

        specIndex = self.GetSpecificRect(vecRect)

        if specIndex < len(vecRect):
            chineseRect = self.GetChineseRect(vecRect[specIndex])
        else:
            return 4

        newSorted = []
        newSorted.append(chineseRect)
        self.RebuildRect(vecRect, newSorted, specIndex)
        if len(newSorted) == 0:
            return 5

        for mr in newSorted:
            x, y, w, h = map(int, mr)
            auxRoi = input_gray[y:y + h, x:x + w]
            if plateType == Color.BLUE:
                _, newroi = cv2.threshold(auxRoi, 5, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)

# Path: lib/easypr/core_func.py
# def clearLiuDingOnly(img):
# def getPlateType(src, adaptive_minsv):
# def clearLiuDingChar(img):
# def clearLiuDing(mask, top, bottom):
# def ThresholdOtsu(mat):
# def bFindLeftRightBound1(bound_threshold):
# def plateColorJudge(src, r, adaptive_minsv):
# def colorMatch(src, r, adaptive_minsv):
# def bFindLeftRightBound(bound_threshold):
#             H = src_hsv[i, j, 0]
#             S = src_hsv[i, j, 1]
#             V = src_hsv[i, j, 2]


# Path: lib/easypr/chars_segment.py
import cv2
import numpy as np
from lib.easypr.core_func import getPlateType, Color, ThresholdOtsu, clearLiuDingChar

            mr = cv2.boundingRect(it)
            x, y, w, h = map(int, mr)

            roi = img_threshold[y:y + h, x:x + w]
            if self.verifyCharSizes(roi):
                vecRect.append(mr)

        if len(vecRect) == 0:
            return 3

        vecRect = sorted(vecRect, key=lambda x: x[0])

        specIndex = self.GetSpecificRect(vecRect)

        if specIndex < len(vecRect):
            chineseRect = self.GetChineseRect(vecRect[specIndex])
        else:
            return 4

        newSorted = []
        newSorted.append(chineseRect)
        self.RebuildRect(vecRect, newSorted, specIndex)
        if len(newSorted) == 0:
            return 5

        for mr in newSorted:
            x, y, w, h = map(int, mr)
            auxRoi = input_gray[y:y + h, x:x + w]
            if plateType == Color.BLUE:
                _, newroi = cv2.threshold(auxRoi, 5, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)

            elif plateType == Color.YELLOW: