Ejemplo n.º 1
0
def run_program():
    # initialize the camera and grab a reference to the raw camera capture
    camera = PiVideoStream().start()

    # initialize the sound object
    soundObj = sound()

    # allow the camera to warm up
    time.sleep(2.0)

    # welcome message
    soundObj.raspberry = True
    soundObj.play_sound('hello', False)

    cap = capture(640, 480)

    # run cardigan processes
    try:
        while True:

            # reload config
            config = Config().getConfig()

            # load frame from camera
            frame = camera.read()

            # start record
            if config['dvr']:
                cap.captureFrame(frame)

            # get GPS data
            position = json.loads(GPS.getPos())

            if config['in_calibration'] or (position and position['speed'] <
                                            config['activation_speed']):
                # Start ADAS process
                frameAnalyzer.analyze_frame(frame, True, True, True)

    except KeyboardInterrupt:
        print "\nattempting to close."
        camera.stop()
        print "\nBye Bye ;-)"

    camera.stop()
Ejemplo n.º 2
0
from classes.capture import capture
from classes.gps import GPS
import time

# # load image
# image = cv2.imread('training/set6/1.png')
# frameAnalyzer.analyze_frame(image, True, False, True)


# load video file
filename = '1464525420'


gps = GPS()
cap = cv2.VideoCapture(PARENT_DIR + "/training/wGPS/clip/"+filename+".avi")
capture = capture(int(cap.get(3)), int(cap.get(4)))
start = time.clock()
c = 0
while True:
    # if c >0:
    #     cv2.waitKey(0)
    # c +=1
    # # print c
    if cap.grab():
        gps.updateSystemPositionData(int(time.clock() - start), filename)

        flag, frame = cap.retrieve()

        frameAnalyzer.analyze_frame(frame, True, True, False, True)

Ejemplo n.º 3
0
import cv2
from classes import frameAnalyzer
from config import *
from classes.capture import capture
from classes.gps import GPS
import time

# # load image
# image = cv2.imread('training/set6/1.png')
# frameAnalyzer.analyze_frame(image, True, False, True)

# load video file
filename = '1464525420'

gps = GPS()
cap = cv2.VideoCapture(PARENT_DIR + "/training/wGPS/clip/" + filename + ".avi")
capture = capture(int(cap.get(3)), int(cap.get(4)))
start = time.clock()
c = 0
while True:
    # if c >0:
    #     cv2.waitKey(0)
    # c +=1
    # # print c
    if cap.grab():
        gps.updateSystemPositionData(int(time.clock() - start), filename)

        flag, frame = cap.retrieve()

        frameAnalyzer.analyze_frame(frame, True, True, False, True)