def edit_benchmark_cc_cmd(
        benchmark_file,
        image_dir,
        omvg_dir,
        cc_id):
    omvg=OpenMVG()
    omvg.set_image_dir(image_dir)
    omvg.set_feature_dir(omvg_dir)
    image_id2name,name2image_id = omvg.loadImageMap()
    gEpG=EpipolarGeometry.load(epipolar_geometry_file)
    bm=load_benchmark(benchmark_file)
    print "benchmark file: ",benchmark_file
    cc=bm.CC.points[cc_id]
    o_ids=bm.cc2oracles(cc_id)
    print cc
    gui=oracle_gui(lambda i:image_dir+image_id2name[i],gEpG,cc)
    for o_id in o_ids:
        o=bm.oracle.points[o_id]
        gui.add_oracle(o)
    gui.play()
    oracle_list=gui.get_oracles()
    for o_id in o_ids:
        bm.oracle.removePoint(o_id)
    for o in oracle_list:
        bm.addOracle(o)
    print "saving ",benchmark_file," :",
    save_benchmark(bm, benchmark_file)
    print "DONE"
def add_cc_t_cmd(
        benchmark_file,
        epipolar_geometry_file,
        image_dir,
        omvg_dir,
        cc_track_file,
        track_file,
        t_ids):
    omvg=OpenMVG()
    omvg.set_image_dir(image_dir)
    omvg.set_feature_dir(omvg_dir)
    image_id2name,name2image_id = omvg.loadImageMap()
    gEpG=EpipolarGeometry.load(epipolar_geometry_file)
    CC=load_tracks(cc_track_file)
    print "connected components file: ",cc_track_file
    T=load_tracks(track_file)
    print "track file: ",track_file, " id:",t_ids
    bm=load_benchmark(benchmark_file)
    print "benchmark file: ",benchmark_file
    for t_id in t_ids:
        t=T.points[t_id]
        cc_ids=CC.viewGroupQuery(t.views)
        assert(len(cc_ids)==1)
        cc=CC.points[cc_ids[0]]
        print cc
        gui=oracle_gui(lambda i:image_dir+image_id2name[i],gEpG,cc)
        gui.play()
        oracle_list=gui.get_oracles()
        bm.addConnectedComponent(cc)
        for o in oracle_list:
            bm.addOracle(o)
        print "saving ",benchmark_file," :",
        save_benchmark(bm, benchmark_file)
        print " DONE"
def new_cmd(benchmark_file,benchmark_label):
    bm=Benchmark(benchmark_label)
    save_benchmark(bm, benchmark_file)