示例#1
0
def main():
    filter = Filter(model_file="model.p", scaler_file="scaler.p")
    #filter.predict_batch(image_path=glob("./labeled_data_smallset/vehicles_smallset/**/*.*"))
    #filter.predict_batch(image_path=filter.test_clf_image_paths)
    frame = None
    cnt = 0
    for path in filter.test_video_images_path:
        cnt += 1
        if frame != None and cnt == frame:
            image = cv2.cvtColor(cv2.imread(path), cv2.COLOR_BGR2RGB)
            final_image = filter.pipepine(image)
            plt.imshow(final_image)
            plt.show()
            break
        elif frame == None:
            image = cv2.cvtColor(cv2.imread(path), cv2.COLOR_BGR2RGB)
            final_image = filter.pipepine(image)
            plt.imshow(final_image)
            plt.show()
    # image_res, centroids_and_sizes = filter.sliding_box_multi_level(image, level=2)
    """
示例#2
0
def main():
    filter = Filter(model_file="model.p", scaler_file="scaler.p")
    clip = VideoFileClip("project_video_short3.mp4")
    cnt = 0
    stop_frame_num = 113
    for img in clip.iter_frames():
        cnt += 1
        if (cnt == stop_frame_num):
            if img.shape[2] == 4:
                img = img[:, :, :3]
            ret = filter.pipepine(img)
            plt.figure(figsize=(16, 10))
            plt.imshow(filter.diagScreen)
            plt.subplots_adjust(left=0.03, bottom=0.03, right=1, top=1)
            plt.show()