Example #1
0
    def __init__(self):
        dmcam.init(None)
        dmcam.log_cfg(dmcam.LOG_LEVEL_INFO, dmcam.LOG_LEVEL_DEBUG,
                      dmcam.LOG_LEVEL_NONE)

        self.dev = dmcam.dev_open(None)
        assert self.dev is not None

        # - set capture config  -
        cap_cfg = dmcam.cap_cfg_t()
        cap_cfg.cache_frames_cnt = 10  # framebuffer = 10
        cap_cfg.on_error = None  # use cap_set_callback_on_error to set cb
        cap_cfg.on_frame_rdy = None  # use cap_set_callback_on_frame_ready to set cb
        cap_cfg.en_save_replay = True  # True = save replay, False = not save
        cap_cfg.en_save_dist_u16 = False  # True to save dist stream for openni replay
        cap_cfg.en_save_gray_u16 = False  # True to save gray stream for openni replay
        cap_cfg.fname_replay = os.fsencode(
            "dm_replay.oni")  # set replay filename

        dmcam.cap_config_set(self.dev, cap_cfg)
        #dmcam.cap_set_frame_buffer(self.dev, None, 10 * 320 * 240 * 4 * 2)

        self.frame_data = bytearray(320 * 240 * 4 * 4)
        self.frame_dist = [np.zeros((240, 320))]
        self.frame_gray = [np.zeros((240, 320))]
        self.frame_cnt = 0

        self.start()
        return
Example #2
0
dev = dmcam.dev_open(devs[0])
# Or open by URI
# dev = dmcam.dev_open_by_uri(br"xxx")
assert dev is not None

# - set capture config  -
cap_cfg = dmcam.cap_cfg_t()
cap_cfg.cache_frames_cnt = 10  # framebuffer = 10
cap_cfg.on_error = None        # use cap_set_callback_on_error to set cb
cap_cfg.on_frame_rdy = None    # use cap_set_callback_on_frame_ready to set cb
cap_cfg.en_save_replay = False  # True = save replay, False = not save
cap_cfg.en_save_dist_u16 = False # True to save dist stream for openni replay
cap_cfg.en_save_gray_u16 = False # True to save gray stream for openni replay
cap_cfg.fname_replay = os.fsencode("dm_replay.oni")  # set replay filename

dmcam.cap_config_set(dev, cap_cfg)
# dmcam.cap_set_callback_on_frame_ready(dev, on_frame_rdy)
# dmcam.cap_set_callback_on_error(dev, on_cap_err)

print(" Set paramters ...")
wparams = {
    dmcam.PARAM_INTG_TIME: dmcam.param_val_u(),
    dmcam.PARAM_FRAME_RATE: dmcam.param_val_u(),
    dmcam.PARAM_MOD_FREQ: dmcam.param_val_u(),

}

# set dual frequency modulation, note that mod_freq0 should always be larger than mod_freq1
# you can trivially set mod_freq1 to zeros, if single frequency modulation is desired 
wparams[dmcam.PARAM_MOD_FREQ].mod_freq0=100000000
wparams[dmcam.PARAM_MOD_FREQ].mod_freq1=36000000