# Path: lib/speed.py
# class SpeedSegmentsDatabase(object):
# class SpeedOMeter(object):
# class SpeedSegment(object):
#     def __init__(self, filepath=Config.SPEED_IMAGE_SEGMENTS_DB_FILEPATH):
#     def get_instance():
#     def load_dict_from_file(filepath):
#     def save(self):
#     def add(self, segment, save=True, force=False):
#     def get_by_key(self, key):
#     def contains_key(self, key):
#     def __init__(self, image):
#     def get_postprocessed_image(self):
#     def get_postprocessed_image_rgb(self):
#     def split_to_segments(self):
#     def predict_speed_raw(self):
#     def predict_speed(self):
#     def postprocess_speed_image(speed_image):
#     def segment_speed_image(speed_image_bin):
#     def __init__(self, arr, label=None):
#     def get_image(self):
#     def predict_label(self):
#     def is_in_database(self):
#     def get_key(self):
#     def to_string(self):
#     def from_string(line):
#     def segment_image_to_key(arr):


import cv2
import numpy as np
import sys
from lib import speed as speedlib
from __future__ import print_function, division

if sys.version_info[0] == 3:
    raw_input = input

def main():
    cv2.namedWindow("segment", cv2.WINDOW_NORMAL)

    db = speedlib.SpeedSegmentsDatabase.get_instance()
    for key in db.segments:
        seg = db.segments[key]
        cv2.imshow("segment", seg.get_image())
        cv2.waitKey(100)
        label = raw_input("Enter label [current label: '%s']: " % (str(seg.label),))

# Path: lib/speed.py
# class SpeedSegmentsDatabase(object):
# class SpeedOMeter(object):
# class SpeedSegment(object):
#     def __init__(self, filepath=Config.SPEED_IMAGE_SEGMENTS_DB_FILEPATH):
#     def get_instance():
#     def load_dict_from_file(filepath):
#     def save(self):
#     def add(self, segment, save=True, force=False):
#     def get_by_key(self, key):
#     def contains_key(self, key):
#     def __init__(self, image):
#     def get_postprocessed_image(self):
#     def get_postprocessed_image_rgb(self):
#     def split_to_segments(self):
#     def predict_speed_raw(self):
#     def predict_speed(self):
#     def postprocess_speed_image(speed_image):
#     def segment_speed_image(speed_image_bin):
#     def __init__(self, arr, label=None):
#     def get_image(self):
#     def predict_label(self):
#     def is_in_database(self):
#     def get_key(self):
#     def to_string(self):
#     def from_string(line):
#     def segment_image_to_key(arr):


# Path: annotate/annotate_speed_segments.py
import cv2
import numpy as np
import sys
from lib import speed as speedlib

from __future__ import print_function, division

if sys.version_info[0] == 3:
    raw_input = input

def main():
    cv2.namedWindow("segment", cv2.WINDOW_NORMAL)

    db = speedlib.SpeedSegmentsDatabase.get_instance()
    for key in db.segments:
        seg = db.segments[key]
        cv2.imshow("segment", seg.get_image())
        cv2.waitKey(100)
        label = raw_input("Enter label [current label: '%s']: " % (str(seg.label),))

        seg.label = label