class HandGestureRecognizer(object): """ Class for converting video footage to a hand gesture """ def __init__(self, videoFeed): """ videoCapture: capture object returned from cv2.VideoCapture """ self._videoFeed = videoFeed self._calibrationController = CalibrationController(self._videoFeed) self._trackingController = TrackingController(self._videoFeed, []) self._neatoController = NeatoController() def calibrate(self): self._trackingController._calibrationColors = self._calibrationController.calibrateColors() print map(lambda x:list(x), self._trackingController._calibrationColors) def trackHand(self,calibrationColors=None): if calibrationColors != None: self._trackingController._calibrationColors = calibrationColors self._trackingController.on('up', self._neatoController.up) self._trackingController.on('left', self._neatoController.left) self._trackingController.on('right', self._neatoController.right) rospy.init_node('rospy_controller', anonymous=True) # r = rospy.Rate(10) # 10hz while not rospy.is_shutdown(): self._trackingController._trackHand()
def __init__(self, videoFeed): """ videoCapture: capture object returned from cv2.VideoCapture """ self._videoFeed = videoFeed self._calibrationController = CalibrationController(self._videoFeed) self._trackingController = TrackingController(self._videoFeed, []) self._neatoController = NeatoController()
def __init__(self, parent=None): super(CalMeas_UI, self).__init__(parent) self.mainWidget = QtGui.QWidget( self) # dummy widget to contain the layout manager self.topWidget = QtGui.QWidget(self) self.bottomWidget = QtGui.QWidget(self) self.mainLayout = QtGui.QVBoxLayout(self.mainWidget) self.topLayout = QtGui.QHBoxLayout(self.topWidget) self.bottomLayout = QtGui.QVBoxLayout(self.bottomWidget) self.setCentralWidget(self.mainWidget) self.mainLayout.addWidget(self.topWidget, stretch=0) self.mainLayout.addWidget(self.bottomWidget, stretch=1) self.SerialController = SerialController(cobsser) self.MeasController = MeasController(calmeas) self.CalibrationController = CalibrationController(calmeas) self.SymbolController = SymbolController(calmeas, self.CalibrationController, self.MeasController) self.SynchController = SynchController(calmeas) #self.tabWidget = QtGui.QTabWidget(self) #self.tabWidget.addTab(self.MeasController.ui, "Symbols") self.bottomLayout.addWidget(self.SymbolController.ui) self.addToolBar(self.MeasController.ui_toolbar) self.topLayout.addWidget(self.SerialController.ui, stretch=0) self.topLayout.addStretch() self.topLayout.addWidget(self.SynchController.ui, stretch=0) # Signaling infrastructure self.SerialController.Connected.connect( self.SynchController.enableInit) self.SerialController.Disconnected.connect( self.SynchController.disableInit) self.SerialController.Disconnected.connect( self.SynchController.disableSynch) self.SerialController.Disconnected.connect(self.MeasController.disable) self.SynchController.InitializationSuccessful.connect( self.SymbolController.addSymbols) self.SynchController.InitializationSuccessful.connect( self.SynchController.enableSynch) self.SynchController.DatasetChanged.connect( self.CalibrationController.refreshAllParameters) self.SynchController.InitializationSuccessful.connect( self.MeasController.enable) self.SynchController.InitializationFailed.connect( self.MeasController.disable) self.SynchController.InitializationFailed.connect( self.SynchController.disableSynch) self.MeasController.MeasurementStarted.connect( lambda onoff=False: self.SymbolController.enablePeriodCombos(onoff )) self.MeasController.MeasurementStopped.connect( lambda onoff=True: self.SymbolController.enablePeriodCombos(onoff)) self.MeasController.MeasurementStarted.connect( self.SynchController.disableInit) self.MeasController.MeasurementStopped.connect( self.SynchController.enableInit) self.MeasController.MeasurementStarted.connect( self.SerialController.onMeasurementStarted) self.MeasController.MeasurementStopped.connect( self.SerialController.onMeasurementStopped) self.setWindowTitle(self.WINDOWTITLE) self.resize(700, 750)