Esempio n. 1
0
def get_plate(wpod_net,image, Dmax=650, Dmin=270):
    vehicle = image
    ratio = float(max(vehicle.shape[:2])) / min(vehicle.shape[:2])
    side = int(ratio * Dmin)
    bound_dim = min(side, Dmax)
    _ , LpImg, _, cor = detect_lp(wpod_net, vehicle, bound_dim, lp_threshold=0.5)
    return vehicle,LpImg, cor
Esempio n. 2
0
def get_plate(image_path, Dmax=608, Dmin = 608):
    vehicle = preprocess_image(image_path)
    ratio = float(max(vehicle.shape[:2])) / min(vehicle.shape[:2])
    side = int(ratio * Dmin)
    bound_dim = min(side, Dmax)
    _ , LpImg, _, cor = detect_lp(wpod_net, vehicle, bound_dim, lp_threshold=0.5)
    return vehicle, LpImg, cor
Esempio n. 3
0
 def __getPlate(self, image, Dmax=608, Dmin=608):
     with self.graph.as_default():
         set_session(self.sess)
         car = self.__changeImage(image)
         ratio = float(max(car.shape[:2])) / min(car.shape[:2])
         side = int(ratio * Dmin)
         bound_dim = min(side, Dmax)
         _, LpImg, _, cor = detect_lp(self.model,
                                      car,
                                      bound_dim,
                                      lp_threshold=0.5)
         return car, LpImg, cor
Esempio n. 4
0
try:
    vid = cv2.VideoCapture(int(video_path))
except:
    vid = cv2.VideoCapture(video_path)

while True:
    return_value, frame = vid.read()
    if return_value:
        frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
        vehicle = frame / 255
        ratio = float(max(vehicle.shape[:2])) / min(vehicle.shape[:2])
        side = int(ratio * Dmin)
        bound_dim = min(side, Dmax)
        _, LpImg, _, cor = detect_lp(wpod_net,
                                     vehicle,
                                     bound_dim,
                                     lp_threshold=0.5)

        plate_image = cv2.convertScaleAbs(LpImg[0], alpha=(255.0))

        # conver to grayscale
        gray = cv2.cvtColor(plate_image, cv2.COLOR_BGR2GRAY)
        blur = cv2.GaussianBlur(gray, (7, 7), 0)

        #Applied inversed thresh_binary where the pixel value less than threshold will be converted to 255 and vice versa
        binary = cv2.threshold(blur, 180, 255,
                               cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]

        ## Applied dilation
        kernel3 = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
        thre_mor = cv2.morphologyEx(binary, cv2.MORPH_DILATE, kernel3)