Exemplo n.º 1
0
from video_capture import video_capture
from renderer import renderer
from openface_handler import openface_handler
from data_saver import data_saver

video_capture = video_capture()
openface_handler = openface_handler()
data_saver = data_saver()
renderer = renderer(video_capture, openface_handler, data_saver)

#renderer.show_frames()

tick = 1  # every ten seconds!

renderer.runopenface_on_frames_everytick(show=True, tick=tick)
#renderer.runopenface_on_frames_nowaiting(show=True)
#renderer.record_frames()

video_capture.destroy()
Exemplo n.º 2
0
trafic_G_lower = [93, 181, 235]
rafic_G_upper = [178, 241, 255]
trafic_G = track_bar('rafic_G', False, trafic_G_lower, rafic_G_upper)

cap = cv2.VideoCapture(0)
cap1 = cv2.VideoCapture(1)
cap.set(3, 320)
cap.set(4, 240)
cap1.set(3, 320)
cap1.set(4, 240)

pub = rospy.Publisher('/forwardVision', forwardVision, queue_size=10)
rospy.init_node('forward_vision')
msg = forwardVision()

dat = data_saver()

#========================================================================================#
while (cap.isOpened() and cap1.isOpened()):

    ret, frame = cap.read()
    ret, frame1 = cap1.read()

    #================================ hsv ===================================================#
    hsv1 = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
    hsv2 = cv2.cvtColor(frame1, cv2.COLOR_BGR2HSV)
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    cv2.rectangle(frame, (0, 275), (600, 300), (0, 255, 0), 2)

    roi1 = hsv1[150:240, 0:320]
    roi1_trafic = hsv1[50:240, 160:320]
Exemplo n.º 3
0
#algo_clustering = 'k-means'
#algo_clustering = 'agglomerative'
algo_clustering = 'spectral'

###########################################################################
# Preparing data for clustering
###########################################################################
training_data = data_loader(file_name, features_names)
logging.info('Data has been prepared')

###########################################################################
# Training the model and get the clusters
###########################################################################
results, model = clustering_algorithms(algo_clustering,
                                       training_data,
                                       nb_clusters,
                                       random_state=seed,
                                       affinity='nearest_neighbors')
logging.info('Training has been done')

###########################################################################
# Saving results
# csv file containing data and a new column : clusters
# a PNG of initial data and new clusters
###########################################################################

features_names.append("clusters")
data_clusters = pd.DataFrame(results, columns=features_names)
data_saver(file_name, data_clusters, algo_clustering)
logging.info('Results saved')
Exemplo n.º 4
0
    listener_1 = Listener(address1)
    data_conn = listener_1.accept()
    print("connected to data stream")

    print("Waiting for real time plotter")
    address2 = ('localhost', plotter_port)
    listener_2 = Listener(address2)
    plotter_conn = listener_2.accept()
    print("Connected to plotter")
    """
        Create data saver object
    """
    print("Creating data saver object")
    current_time = strftime(f"%b%d_%H%M", localtime())
    current_dir = current_time + "test"
    saver = data_saver(current_dir, program_state)
    print(f"Current time is {current_time}. Successfully created saver")

    program_mode = "DEV_MODE"
    """
        Initialize pygame and the other visual programs
    """
    pygame.init()
    if pygame.mixer and not pygame.mixer.get_init():
        print('Warning, no sound')
        pygame.mixer = None
        quit()

    width, height = 600, 600
    screen = pygame.display.set_mode((width, height))