def __init__(self, settingsPath, objectsPath, cascadePath): """ :param settingsPath: The full path to Settings.txt :param objectsPath: The path to directory that holds Objects, for ObjectManager :param cascadePath: The path to the directory that holds the eye_cascade.xml, face_cascade.xml, and smile_cascade.xml """ # Initialize Global Variables Global.init() # Load settings before any objects are created self.__settingsPath = settingsPath self.__settings = self.__loadSettings() # Set up environment objects self.__vStream = Video.VideoStream() # Gets frames constantly self.__robot = Robot.Robot() self.__vision = Vision( self.__vStream, cascadePath ) # Performs computer vision tasks, using images from vStream self.__objectMngr = ObjectManager.ObjectManager(objectsPath) self.__transform = None # If the settings have any information, try to instantiate objects. Otherwise, GUI will do this as user requests cameraID = self.__settings['cameraID'] if cameraID is not None: self.__vStream.setNewCamera(cameraID) robotID = self.__settings['robotID'] if robotID is not None: self.__robot.setUArm(robotID) ptPairs = self.__settings["coordCalibrations"]["ptPairs"] if ptPairs is not None: self.__transform = Transform(ptPairs)
def __init__(self, settingsPath, objectsPath, cascadePath): """ :param settingsPath: The full path to Settings.txt :param objectsPath: The path to directory that holds Objects, for ObjectManager :param cascadePath: The path to the directory that holds the eye_cascade.xml, face_cascade.xml, and smile_cascade.xml """ # Initialize Global Variables Global.init() # Load settings before any objects are created self.__settingsPath = settingsPath self.__settings = self.__loadSettings() # Set up environment objects self.__vStream = Video.VideoStream() # Gets frames constantly self.__robot = Robot.Robot() self.__vision = Vision(self.__vStream, cascadePath) # Performs computer vision tasks, using images from vStream self.__objectMngr = ObjectManager.ObjectManager(objectsPath) self.__transform = None # If the settings have any information, try to instantiate objects. Otherwise, GUI will do this as user requests cameraID = self.__settings['cameraID'] if cameraID is not None: self.__vStream.setNewCamera(cameraID) robotID = self.__settings['robotID'] if robotID is not None: self.__robot.setUArm(robotID) ptPairs = self.__settings["coordCalibrations"]["ptPairs"] if ptPairs is not None: self.__transform = Transform(ptPairs)
def __init__(self, settingsPath=Paths.settings_txt, resourcePath=Paths.resourcesLoc): # Initialize Global Variables Global.init() # Load settings before any objects are created self.__settingsPath = settingsPath self.__settings = self.__loadSettings() # Set up environment objects self.__vStream = Video.VideoStream() # Gets frames constantly self.__robot = Robot.Robot() self.__vision = Vision(self.__vStream) # Performs computer vision tasks, using images from vStream self.__objectMngr = ObjectManager.ObjectManager() # If the settings have any information, try to instantiate objects. Otherwise, GUI will do this as user requests cameraID = self.__settings['cameraID'] if cameraID is not None: self.__vStream.setNewCamera(cameraID) robotID = self.__settings['robotID'] if robotID is not None: self.__robot.setUArm(robotID) self.__objectMngr.loadAllObjects()
return super(Application, self).notify(receiver, event) if __name__ == '__main__': # Install a global exception hook to catch pyQt errors that fall through (helps with debugging a ton) #TODO: Remove for builds sys.__excepthook = sys.excepthook sys._excepthook = sys.excepthook def exception_hook(exctype, value, traceback): sys._excepthook(exctype, value, traceback) sys.exit(1) sys.excepthook = exception_hook # Initialize global variables Global.init() # Create the Application base global app,trans app = Application(sys.argv) trans = QtCore.QTranslator(app) # app = QtGui.QApplication(sys.argv) # Apply a stylesheet (theme) of choice here # app.setStyleSheet(fancyqt.firefox.style) # Set Application Font font = QtGui.QFont() font.setFamily("Verdana")
if __name__ == '__main__': '''Install a global exception hook to catch pyQt errors that fall through (helps with debugging a ton) sys.__excepthook = sys.excepthook sys._excepthook = sys.excepthook def exception_hook(exctype, value, traceback): sys._excepthook(exctype, value, traceback) sys.exit(1) sys.excepthook = exception_hook ''' # Initialize global variables Global.init() # Create the Application base app = Application(sys.argv) # Apply a theme of choice here # app.setStyleSheet(fancyqt.firefox.style) # Set Application Font font = QtGui.QFont() font.setFamily("Verdana") font.setPixelSize(12)