Beispiel #1
0
setup_complete = False
tracking = False
text_on_image = 'No cars'
prompt = ''

webcam = Webcam("calibrated.avi", FPS)

# create an image window and place it in the upper left corner of the screen
cv2.namedWindow("Speed Camera")
cv2.moveWindow("Speed Camera", 10, 40)

# call the draw_rectangle routines when the mouse is used
cv2.setMouseCallback('Speed Camera', draw_rectangle)

# grab a reference image to use for drawing the monitored area's boundry
image = webcam.get_image()
org_image = image.copy()

if SAVE_CSV:
    csvfileout = "carspeed_{}.cvs".format(
        datetime.datetime.now().strftime("%Y%m%d_%H%M"))
    record_speed('Date,Day,Time,Speed,Image')
else:
    csvfileout = ''

prompt = "Define the monitored area - press 'c' to continue"
prompt_on_image(prompt)

# wait while the user draws the monitored area's boundry
while not setup_complete:
    cv2.imshow("Speed Camera", image)