Beispiel #1
0
    def select_ImageRegistration(self, mode=0):

        self.dev.is_image_registration_mode_supported(
            c_api.OniImageRegistrationMode.
            ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR)
        result = self.dev.get_image_registration_mode()
        print("当前图像配准模式:", result)

        if mode == 0:
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_OFF
        elif mode == 1:
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR
        elif mode == 2:
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_DEPTH_IR_TO_COLOR
        elif mode == 3:
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_COLOR_TO_DEPTH
        elif mode == 4:
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_COLOR_UNDISTORTION_ONLY
        else:
            print("Test ImageRegistration Mode Error!")
            return False

        res = self.dev.is_image_registration_mode_supported(mode)
        print("Support Result:", res)
        if res:
            try:
                c_api.oniDeviceSetProperty(
                    self.dev._handle,
                    c_api.ONI_DEVICE_PROPERTY_IMAGE_REGISTRATION,
                    ctypes.byref(obj), ctypes.sizeof(obj))
                result = self.dev.get_image_registration_mode()
            except Exception as e:
                print("*Test Registration Error!: %r " % e)
                return False
            print("设置后的图像配准模式:", result)
            if obj == result:
                return True
            else:
                print("图像配准设置失败")
                return False
        else:
            print("Is_image_registration_mode_supported Error")
            return False
Beispiel #2
0
    def select_ImageRegistration(self, mode=0):
        mode = int(mode)
        self.dev.is_image_registration_mode_supported(
            c_api.OniImageRegistrationMode.
            ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR)
        result = self.dev.get_image_registration_mode()
        self.log.debug("当前图像配准模式: %r" % result)
        if (mode == 0):
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_OFF
        elif (mode == 1):
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR
        elif (mode == 2):
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_DEPTH_IR_TO_COLOR
        elif (mode == 3):
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_COLOR_TO_DEPTH
        elif (mode == 4):
            obj = c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_COLOR_UNDISTORTION_ONLY
        else:
            self.log.error("Test ImageRegistration Mode Error!")
            return (False)

        res = self.dev.is_image_registration_mode_supported(mode)
        self.log.debug("Support Result: %r" % res)
        if res:
            try:
                c_api.oniDeviceSetProperty(
                    self.dev._handle,
                    c_api.ONI_DEVICE_PROPERTY_IMAGE_REGISTRATION,
                    ctypes.byref(obj), ctypes.sizeof(obj))
                result = self.dev.get_image_registration_mode()
            except Exception as e:
                self.log.error("Test Registration Error!: %r" % e)
                return (False)
            self.log.info("设置后的图像配准模式: %r" % result)
            if (obj == result):
                return (True)
            else:
                self.log.error("图像配准设置失败")
                return (False)
        else:
            self.log.error("Is_image_registration_mode_supported Error")
            return (False)
Beispiel #3
0
 def set_property(self, property_id, obj, size=None):
     obj, size = _py_to_ctype_obj(obj)
     if size is None:
         size = ctypes.sizeof(obj)
     c_api.oniDeviceSetProperty(self._handle, property_id,
                                ctypes.byref(obj), size)