def setup(self): print 'setup' self.capture = cv2.VideoCapture(0) self.capture.set(cv2.CAP_PROP_FRAME_WIDTH, 320) self.capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 240) self.capture.set(cv2.CAP_PROP_SATURATION, 150) self.clf = clasificadorEuc.Clasificador(datasetGenerator.shapeD) self.clf.train() self.targetDistance = 30.0 self.targetX = 160 self.targetY = 120 self.state = 'findBall' self.states = { 'findBall': { 'action': self.waitStopped }, 'followBall': { 'action': self.followBall } } self.ballPosition = {}
# Autores: # Luciano Garcia Giordano - 150245 # Gonzalo Florez Arias - 150048 # Salvador Gonzalez Gerpe - 150044 import cv2 from matplotlib import pyplot as plt import numpy as np import config import datasetGenerator import clasificadorEuc import imutils import time clf = clasificadorEuc.Clasificador(datasetGenerator.shapeD) clf.train() # Inicio la captura de imagenes # capture = cv2.VideoCapture('./videos/videoBola.mp4') capture = cv2.VideoCapture(0) capture.set(cv2.CAP_PROP_FRAME_WIDTH, 320) capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 240) # Ahora clasifico el video frame = 0 size = 1 while (True): # capture.set(cv2.CAP_PROP_POS_FRAMES, frame) # frame += 1 #2