# -- set debug level dmcam.log_cfg(dmcam.LOG_LEVEL_INFO, dmcam.LOG_LEVEL_DEBUG, dmcam.LOG_LEVEL_NONE) # -- list device print(" Scanning dmcam device ..") devs = dmcam.dev_list() if devs is None: print(" No device found") sys.exit(1) print("found %d device" % len(devs)) for i in range(len(devs)): print("#%d: %s" % (i, dmcam.dev_get_uri(devs[i], 256)[0])) print(" Open dmcam device ..") # open the first device 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
# init with specified log file # dmcam.init("test.log") # set debug level dmcam.log_cfg(dmcam.LOG_LEVEL_INFO, dmcam.LOG_LEVEL_DEBUG, dmcam.LOG_LEVEL_NONE) print(" Scanning dmcam device ..") devs = dmcam.dev_list() if devs is None: print(" No device found") else: print("found %d device" % len(devs)) print(" Device URIs:") for i, d in enumerate(devs): print("[#%d]: %s" % (i, dmcam.dev_get_uri(d, 256)[0])) if dev_uri: dev = dmcam.dev_open_by_uri(os.fsencode(sys.argv[1])) else: # open the first device # dev = dmcam.dev_open(devs[0]) dev = dmcam.dev_open(None) if dev is None: print(" Open device failed") sys.exit(-1) else: print(" Open dmcam device: %s " % dmcam.dev_get_uri(dev, 256)[0]) # print(" Config capture param ..")