示例#1
0
def vehicle_detect_data_summary():
    clf = classifier.Classifier()
    clf.summarize_dataset()

    cars, not_cars = clf._get_dataset()
    single_car, single_not_car = image.load_img(
        random.choice(cars)), image.load_img(random.choice(not_cars))

    plotter.Plotter(True).plot_images(single_car, single_not_car)
示例#2
0
def vehicle_detect_hog_sample():
    clf = classifier.Classifier()

    cars, not_cars = clf._get_dataset()

    single_car = image.convert_color(image.load_img(random.choice(cars)),
                                     features.COLOR_SPACE)
    _, single_car_hog = features.hog_features_by_channel(single_car,
                                                         0,
                                                         visualise=True)
    plotter.Plotter(True).plot_images(single_car, single_car_hog)

    single_not_car = image.convert_color(
        image.load_img(random.choice(not_cars)), features.COLOR_SPACE)
    _, single_not_car_hog = features.hog_features_by_channel(single_not_car,
                                                             0,
                                                             visualise=True)
    plotter.Plotter(True).plot_images(single_not_car, single_not_car_hog)
示例#3
0
def vehicle_detect_single_image(img_path=None):
    if not img_path:
        img_path = 'test_images/test1.jpg'

    init_logging()

    clf = classifier.Classifier()
    clf.from_pickle(VEHICLE_DETECTION_CLASSIFIER_PATH)

    detect = detector.Detector(clf)

    img = image.load_img(img_path)

    calibrator = camera_calibration.CameraCalibration(get_plotter())
    calibrator.config()

    undisorted = calibrator.undistort(img)
    output = detect.identify_vehicles(undisorted)

    plotter.Plotter(True).plot_images(output)
#!/usr/bin/env python3

import logging as log
import os

from clize import run
import cv2
from moviepy.editor import VideoFileClip

from lane_finder import camera_calibration, plotter, lane_finder

PLOT = plotter.Plotter(False)
INIT = False

CAMERA_CALIBRATION_PICKLE_PATH = 'camera_calibration.P'

def init_logging():
    log.basicConfig(
        format='%(asctime)s %(message)s',
        level=log.INFO)

def get_plotter(show_plots=False):
    PLOT.show_plots = show_plots
    return PLOT

def test_calibrate_camera():
    init_logging()
    plot = get_plotter()

    calibrator = camera_calibration.CameraCalibration(plot)
    calibrator.config()