示例#1
0
    def __init__(self, controller, stgs = {}):
        """
        IDM's init function.

        Arguments:
        - self: The main object pointer.
        - controller: mousetrap main class pointer. This is passed by MouseTrap's controller (mousetrap.py) when loaded.
        - stgs: Possible settings loaded from the user's settings file. If there aren't settings the IDM will use the a_settings dict.
        """
        # Debugging is always important
        debug.debug("ocvfw.idm", "Starting %s idm" % a_name)

        # Controller instance
        self.ctr          = controller

        # Capture instance
        # The capture is the object containing the image
        # and all the possible methods to modify it.
        self.cap          = None

        # IDM's Settings dict
        self.stgs         = stgs

        # Prepares the IDM using the settings.
        self.prepare_config()

        debug.info("ocvfw.idm", "%s Algorithm loaded" % a_name)
示例#2
0
文件: eyes.py 项目: fnv/mousetrap
    def __init__(self, controller, stgs = {}):
        """
        IDM's init function.

        Arguments:
        - self: The main object pointer.
        - controller: mousetrap main class pointer. This is passed by MouseTrap's controller (mousetrap.py) when loaded.
        - stgs: Possible settings loaded from the user's settings file. If there aren't settings the IDM will use the a_settings dict.
        """
        debug.debug("ocvfw.idm", "Starting %s idm" % a_name)
        
        self.img          = None
        self.ctr          = controller
        self.cap          = None
        self.stgs         = stgs

        ##############################
        #  MOTION RELATED VARIABLES  #
        ##############################

        self.fel = eye_locator(FEL_NAME)

        ##############################
        #       ACTION POINTS        #
        ##############################
        self.mpPointer       = None

        ##############################
        #  CLICK RELATED VARIABLES   #
        ##############################

        self.isMoving       = False

        self.prepare_config()
        debug.info("ocvfw.idm", "Forhead Algorithm loaded")
示例#3
0
    def __init__(self, controller, stgs={}):
        """
        IDM's init function.
        
        Arguments:
        - self: The main object pointer.
        - controller: mousetrap main class pointer. This is passed by MouseTrap's controller (mousetrap.py) when loaded.
        - stgs: Possible settings loaded from the user's settings file. If there aren't settings the IDM will use the a_settings dict.
        """
        # Debugging is always important
        debug.debug("ocvfw.idm", "Starting %s idm" % a_name)

        # Controller instance
        self.ctr = controller

        # Capture instance
        # The capture is the object containing the image
        # and all the possible methods to modify it.
        self.cap = None

        # IDM's Settings dict
        self.stgs = stgs

        # Prepares the IDM using the settings.
        self.prepare_config()

        debug.info("ocvfw.idm", "%s Algorithm loaded" % a_name)
示例#4
0
文件: forehead.py 项目: fnv/mousetrap
 def set_capture(self, cam):
     """
     Initialize the capture and sets the main settings.
     
     Arguments:
     - self: The main object pointer
     - cam: The camera device index. For Example: 0 = /dev/video0, 1 = /dev/video1
     """
     
     debug.debug("ocvfw.idm", "Setting Capture")
     
     self.cap = Capture(async=True, idx=cam, backend="OcvfwPython")
     self.cap.change(color="rgb")
     self.cap.set_camera("lk_swap", True)
示例#5
0
    def set_capture(self, cam):
        """
        Initialize the capture and sets the main settings.

        Arguments:
        - self: The main object pointer
        - cam: The camera device index. For Example: 0 = /dev/video0, 1 = /dev/video1
        """

        debug.debug("ocvfw.idm", "Setting Capture")

        # Starts the Capture using the async method.
        # This means that self.cap.sync() wont be called periodically
        # by the idm because the Capture syncs the image asynchronously (See dev/camera.py)
        # The default backend used is OcvfwPython but it is possible to chose other backends
        # that will use other libs to process images.
        self.cap = Capture(async=True, idx=cam, backend="OcvfwPython")

        # This sets the final image default color to rgb. The default color is bgr.
        self.cap.change(color="rgb")
示例#6
0
    def set_capture(self, cam):
        """
        Initialize the capture and sets the main settings.
        
        Arguments:
        - self: The main object pointer
        - cam: The camera device index. For Example: 0 = /dev/video0, 1 = /dev/video1
        """

        debug.debug("ocvfw.idm", "Setting Capture")

        # Starts the Capture using the async method.
        # This means that self.cap.sync() wont be called periodically
        # by the idm because the Capture syncs the image asynchronously (See dev/camera.py)
        # The default backend used is OcvfwPython but it is possible to chose other backends
        # that will use other libs to process images.
        self.cap = Capture(async=True, idx=cam, backend="OcvfwPython")

        # This sets the final image default color to rgb. The default color is bgr.
        self.cap.change(color="rgb")