예제 #1
0
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 ..")
# set 10 frames framebuffer
# dmcam.cap_set_frame_buffer(dev, None, 10 * 320 * 240 * 4 * 2)
예제 #2
0
import glob
import cv2

cnt = 0
row = 1

for file in glob.glob(r"dmrep_20200407_132641.oni"):
    print("file=", file)

    read_oni_file_path = file

    dmcam.init(None)

    dmcam.log_cfg(dmcam.LOG_LEVEL_INFO, dmcam.LOG_LEVEL_DEBUG,
                  dmcam.LOG_LEVEL_NONE)
    dev = dmcam.dev_open_by_uri(os.fsencode(file))

    print(" Config capture param ..")
    cap_cfg = dmcam.cap_cfg_t()
    cap_cfg.cache_frames_cnt = 10  # frame buffer = 10 frames

    cap_cfg.en_save_dist_u16 = False  # save dist into ONI file: which can be viewed in openni
    cap_cfg.en_save_gray_u16 = False  # save gray into ONI file: which can be viewed in openni
    cap_cfg.en_save_replay = False  # save raw into ONI file:  which can be simulated as DMCAM device
    cap_cfg.fname_replay = os.fsencode("replay_dist.oni")

    dmcam.cap_config_set(dev, cap_cfg)

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