Exemplo n.º 1
0
            os.path.join(slice_dir, 'depth_' + str(i).rjust(10, '0') + '.png'),
            depth.astype(np.uint16))
        cv2.imwrite(
            os.path.join(slice_dir, 'mask_' + str(i).rjust(10, '0') + '.png'),
            mask.astype(np.uint16))

        eimg = dvs_img(sl, (RES_X, RES_Y),
                       None,
                       None,
                       args.slice_width,
                       mode=1)

        nmin = np.nanmin(depth)
        nmax = np.nanmax(depth)

        eimg[:, :, 2] = (depth - nmin) / (nmax - nmin) * 255
        col_mask = mask_to_color(mask)

        rgb_img = np.dstack((classical[i], classical[i], classical[i]))
        rgb_img[
            mask > 10] = rgb_img[mask > 10] * 0.5 + col_mask[mask > 10] * 0.5
        eimg = np.hstack((rgb_img, eimg))

        footer = gen_text_stub(eimg.shape[1], frame)
        eimg = np.vstack((eimg, footer))

        cv2.imwrite(
            os.path.join(vis_dir, 'frame_' + str(i).rjust(10, '0') + '.png'),
            eimg)
    print(pydvs.okg("\nDone.\n"))
Exemplo n.º 2
0
import os, sys
import pydvs

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--event_file', type=str, required=True)
    parser.add_argument('--output_file', type=str, required=True)
    parser.add_argument('--discretization',
                        type=float,
                        required=False,
                        default=0.01)
    parser.add_argument('--calib', type=str, required=False, default='')

    args = parser.parse_args()

    print("Opening event file:", pydvs.okg(args.event_file))

    cloud, idx = pydvs.read_event_file_txt(args.event_file,
                                           args.discretization)

    K = None
    D = None
    if ('txt' in args.calib):
        K, D = pydvs.read_calib_txt(args.calib)
    elif ('yaml' in args.calib):
        K, D = pydvs.read_calib_yaml(args.calib)
    elif (args.calib != ''):
        print(pydvs.bld(pydvs.err("Error: Unknown calibration file format!")),
              args.calib)

    print("Saving...")