(i, devs[i].if_info.info.usb.usb_port_num, devs[i].if_info.info.usb.usb_bus_num, devs[i].if_info.info.usb.usb_dev_addr, devs[i].vendor, devs[i].product, devs[i].serial)) print(" Open dmcam device ..") # open the first device # dev = dmcam.dev_open(devs[0]) dev = dmcam.dev_open(None) assert dev is not None # print(" Config capture param ..") # set 10 frames framebuffer dmcam.cap_set_frame_buffer(dev, None, 10 * 320 * 240 * 4) # dmcam.cap_set_callback_on_frame_ready(dev, on_frame_rdy) dmcam.cap_set_callback_on_error(dev, on_cap_err) # write to ramp mode # dmcam.reg_batch_write(dev, dmcam.DEV_REG_TFC_DE, 0x31, np.array([0x1803], dtype="uint32")) # regval = dmcam.reg_batch_read(dev, dmcam.DEV_REG_TFC_DE, 0x31, 1) # print(regval) # assert regval[0] == 0x1803 print(" Set paramters ...") # write illumination power: 100% pwr_percent = 100 wparams = { dmcam.PARAM_ILLUM_POWER: dmcam.param_val_u(), dmcam.PARAM_INTG_TIME: dmcam.param_val_u(), dmcam.PARAM_FRAME_FORMAT: dmcam.param_val_u(), }
#file_dep = open("I:\TOF\HEAD\data/20180416.bin", 'rb') dmcam.init(None) dmcam.log_cfg(dmcam.LOG_LEVEL_INFO, dmcam.LOG_LEVEL_DEBUG, dmcam.LOG_LEVEL_NONE) devs = dmcam.dev_list() if devs is None: print(" No device found") sys.exit(1) dev = dmcam.dev_open(None) dmcam.cap_set_frame_buffer(dev, None, 320 * 240 * 4 * 10) dmcam.cap_set_callback_on_frame_ready(dev, None) dmcam.cap_set_callback_on_error(dev, None) wparams = { dmcam.PARAM_INTG_TIME: dmcam.param_val_u(), dmcam.PARAM_FRAME_FORMAT: dmcam.param_val_u(), } wparams[dmcam.PARAM_INTG_TIME].intg.intg_us = 1400 wparams[dmcam.PARAM_FRAME_FORMAT].frame_format.format = 1 amp_min_val = dmcam.filter_args_u() amp_min_val.min_amp = 0 if not dmcam.filter_enable(dev, dmcam.DMCAM_FILTER_ID_AMP, amp_min_val, sys.getsizeof(amp_min_val)): print(" set amp to %d %% failed" % 0) if not dmcam.param_batch_set(dev, wparams):