示例#1
0
def night():
    global refPt
    _, image = cap.read()
    ctt = 0

    Quit = selectRegions(image, "Click points to select your vehicle dash.", 1)
    dashPointer = refPt
    if len(dashPointer) <= 2:
        dashPointer = [[0, 0], [0, 0], [0, 0]]
    refPt = []
    print("For dash: ", dashPointer)
    if Quit == 1:
        return
    cv2.destroyWindow("ROI")

    fps = FPS().start()
    while True:
        _, frame = cap.read()
        if _ == False:
            break

        # print(ctt ,fps._numFrames)
        # ctt = ctt + 1
        break_light_utils.break_light(dashPointer, frame)

        # cv2.imshow("original",frame)
        key = cv2.waitKey(1) & 0xFF
        fps.update()
        if key == ord('q'):
            break
    fps.stop()
    print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
    print("[INFO] approx. FPS: {:.2f}".format(fps.fps()))
示例#2
0
                if len(dashPointer) <= 2:
                    dashPointer = [[0, 0], [0, 0], [0, 0]]
                refPt = []
                print("For dash: ", dashPointer)
                fps = FPS().start()
            else:
                _, frame = cap.read()
                if _ == False:
                    fps.stop()
                    print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
                    print("[INFO] approx. FPS: {:.2f}".format(fps.fps()))
                    break
                # print(ctt ,fps._numFrames)
                ctt = ctt + 1

                break_light_utils.break_light(dashPointer, frame)

                # cv2.imshow("original",frame)
                fps.update()
                if key == ord('q'):
                    fps.stop()
                    print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
                    print("[INFO] approx. FPS: {:.2f}".format(fps.fps()))
                    break
            if Quit:
                break
        else:  # DAY TIME
            key = cv2.waitKey(1) & 0xFF
            if cropped == 0:
                Quit = selectRegions(
                    copy.deepcopy(image),