コード例 #1
0
ファイル: testscript_3d.py プロジェクト: gyaansastra/DeepLab
for idx, name in enumerate(cam2_images):
    os.rename(
        name,
        os.path.join(cwd,
                     str("camera-2_" + "{0:0=2d}".format(idx + 1) + ".jpg")))

# Removing some of the images where the corner was not detected
[os.remove(file) for file in glob.glob(os.path.join(cwd, "*06.jpg"))]
[os.remove(file) for file in glob.glob(os.path.join(cwd, "*01.jpg"))]

print("CALIBRATING THE CAMERAS")
deeplabcut.calibrate_cameras(path_config_file, calibrate=True)

print("CHECKING FOR UNDISTORTION")
deeplabcut.check_undistortion(path_config_file)

print("TRIANGULATING")
video_dir = os.path.join(basepath, folder)
deeplabcut.triangulate(path_config_file, video_dir, save_as_csv=True)

print("CREATING LABELED VIDEO 3-D")
deeplabcut.create_labeled_video_3d(path_config_file, [video_dir],
                                   start=5,
                                   end=10)

# output_path = [os.path.join(basepath,folder)]
# deeplabcut.create_labeled_video_3d(path_config_file,output_path,start=5,end=10)

print("ALL DONE!!! - default 3D cases are functional.")
コード例 #2
0
                                                      "R": doveye_calib['R'][pair_idx],
                                                      "T": doveye_calib['T'][pair_idx],
                                                      "E": [],
                                                      "F": doveye_calib['F'][pair_idx],
                                                      "R1": R1,
                                                      "R2": R2,
                                                      "P1": P1,
                                                      "P2": P2,
                                                      "roi1": roi1,
                                                      "roi2": roi2,
                                                      "Q": Q,
                                                      "image_shape": [(1086,2040),(1086,2040)]}

    print('Saving the stereo parameters for every pair of cameras as a pickle file in %s' % str(
        os.path.join(path_camera_matrix)))

    auxiliaryfunctions.write_pickle(os.path.join(path_camera_matrix, 'stereo_params.pickle'), stereo_params)
    print("Camera calibration done! Use the function ``check_undistortion`` to check the check the calibration")

    pass

if __name__=='__main__':
    cfg='/home/bonaiuto/Projects/tool_learning/preprocessed_data/dlc_projects/motor_grasp_3d-Jimmy-2019-08-13-3d/config.yaml'

    #convert_doveeye_to_dlc(cfg, '/home/bonaiuto/Projects/tool_learning/data/video/calibrated_25.10.18.yaml')

    #deeplabcut.calibrate_cameras(cfg,cbrow=8,cbcol=6,calibrate=True,alpha=0.9)
    #deeplabcut.calibrate_cameras(cfg, cbrow=8, cbcol=6, calibrate=True, alpha=0.9)

    deeplabcut.check_undistortion(cfg)