示例#1
0
def analyze(s, d, vlogger):
    finder = PlateDetector(vlogger)
    while True:
        f = s.get()
        if f is None: return
        img = cv2.imread(f)
        if img is None:
            logging.error('%s no se pudo abrir',f)
        txt,r = finder.find2(img)
        fn = ntpath.basename(f)
        orig = fn[:6].upper()
        logging.debug("%s: %s"%(fn[:6].upper(),txt))
        d.put((txt, r, txt==orig))
示例#2
0
def analyze(src, dst):
    detector  = PlateDetector()
    while True:
        ts, id, img, bbox = src.get()
        if img is None: return
        try:
            code, bbox_code = detector.first(img)
            if code is not None:
                bbox_code = list(bbox_code)
                bbox_code[0] += bbox[0]
                bbox_code[1] += bbox[1]
                dst.put((id, ts, img, code, bbox_code))
        except Exception as e:
            logging.debug('error analyzing frame')
            logging.error(e, exc_info=True)
示例#3
0
from timeit import default_timer as timer
import sys
import cv2
import os
from platedetector import PlateDetector
import logging 
import time
import numpy as np

if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG)
    s = timer()
    finder = PlateDetector()

    if len(sys.argv)!=2:
        uri = "videotestsrc ! capsfilter caps='video/x-raw,format=BGR' ! videoconvert ! appsink"
        p = os.path.dirname(os.path.abspath(__file__))
    else:
        uri = sys.argv[1]
        tmpdir = os.path.splitext(os.path.abspath(uri))[0]
        if not os.path.exists(tmpdir):
                print 'creando directorio '+tmpdir
                os.makedirs(tmpdir)
        else:
                print 'directorio ya existe '+tmpdir

    c = cv2.VideoCapture(uri)
    cv2.namedWindow('e2',cv2.WINDOW_NORMAL)
    paused = False
    fc = 0
    while True:
示例#4
0
from timeit import default_timer as timer
import sys
import cv2
import os
from platedetector import PlateDetector
import logging 
import time

if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG)
    s = timer()
    finder = PlateDetector()

    if len(sys.argv)!=2:
        uri = "videotestsrc ! capsfilter caps='video/x-raw,format=BGR' ! videoconvert ! appsink"
        p = os.path.dirname(os.path.abspath(__file__))
    else:
        uri = sys.argv[1]
        tmpdir = os.path.splitext(os.path.abspath(uri))[0]
        if not os.path.exists(tmpdir):
                print 'creando directorio '+tmpdir
                os.makedirs(tmpdir)
        else:
                print 'directorio ya existe '+tmpdir

    c = cv2.VideoCapture(uri)
    cv2.namedWindow('e2',cv2.WINDOW_NORMAL)
    paused = False
    fc = 0
    while True:
        fc = fc + 1
示例#5
0
import constant
# from darknetdetector import Detector
from videoextractor import VideoExtractor
from platedetector import PlateDetector

# video_extractor = VideoExtractor()
# video_extractor.extract_to(video_extractor.get_random_stream_url(), "./out/", 0.5, 10, True)

plate_detector = PlateDetector()
plate_detector.load_and_detect_img("./data/plate/test/001.JPG")

# detector = Detector(Constant.DARK_NET_CFG_PATH + "yolo.cfg",  "yolo.weights",
#                     Constant.DARK_NET_CFG_PATH + "coco.data")
# detector.detect_all_image_in_folder(Constant.IMAGE_DETECT_INPUT_PATH,
#                                     Constant.IMAGE_DETECT_OUTPUT_PATH)