def estimatedisp():

    # check img source and target
    img_source = img_target.get()
    img_store = disp_store.get()
    if img_source == 'Img1':
        if not isThereImg1:
            print("Missing the input image! Please load img1")
            #return
        else:
            # read the parameters
            min_disp = float(Gui.get_dmin(root))
            if min_disp < 0 or min_disp > 12:
                print("Wrong value of Minimum Disparity!")
            max_disp = float(Gui.get_dmax(root))
            coc = Gui.get_coc(root)
            pen1 = Gui.get_pen1(root)
            pen2 = Gui.get_pen2(root)
            cover = Gui.get_cover(root)
            image_path_png = "{0}/{1}".format(Gui.get_path(root),
                                              Gui.get_entry1(root))
            basename, suffix = os.path.splitext(image_path_png)
            image_path_config = basename + ".xml"
            #pack all
            params = pldisp.EvalParameters()
            params.filename = image_path_config
            params.scene_type = 'real'
            params.min_disp = float(min_disp)
            params.max_disp = float(max_disp)
            params.coc_thresh = float(coc)
            params.penalty1 = float(pen1)
            params.penalty2 = float(pen2)
            params.max_ring = float(cover)

            disp_pack = pldisp.estimate_disp(params)
            pdb.set_trace()
    if img_source == 'Img2' and not isThereImg2:
        print("Missing the input image! Please load img2")
        return
    if img_source == 'Img3' and not isThereImg3:
        print("Missing the input image! Please load img3")
        return
    if img_source == 'Img4' and not isThereImg4:
        print("Missing the input image! Please load img4")
        return

    disp_path_to_save = "{0}/{1}".format(Gui.get_path(root),
                                         Gui.get_disp_path(root))
    plt.imsave(disp_path_to_save, disp_pack[1])
    print("Disparity Calculated and Saved!")
示例#2
0
    params = rtxmain.EvalParameters()
    params.filename = args.input_filename[0]
    params.coarse = args.coarse
    params.technique = args.technique
    params.method = 'real_lut'
    params.min_disp = args.min_disp
    params.max_disp = args.max_disp
    params.num_disp = args.num_disp
    params.scene_type = args.scene_type
    params.analyze_err = args.error

    full_name, nothing = params.filename.split('.xml')
    separate_names = full_name.split('/')
    pic_name = separate_names[len(separate_names) - 1]

    I, disp, Dwta, Dgt, Dconf, Dcoarse, disparities, ncomp, disp_avg, new_offset, error_measurements = rtxmain.estimate_disp(
        params)

    disp_name = "{0}/{1}_disp_{2}_{3}_{4}_{5}.png".format(
        args.output_path, pic_name, params.method, disparities[0],
        disparities[-1], params.technique)
    disp_name_col = "{0}/{1}_disp_col_{2}_{3}_{4}_{5}.png".format(
        args.output_path, pic_name, params.method, disparities[0],
        disparities[-1], params.technique)
    gt_name = "{0}/{1}_gt_{2}_{3}_{4}_{5}.png".format(args.output_path,
                                                      pic_name, params.method,
                                                      disparities[0],
                                                      disparities[-1],
                                                      params.technique)
    gt_name_col = "{0}/{1}_gt_col_{2}_{3}_{4}_{5}.png".format(
        args.output_path, pic_name, params.method, disparities[0],
        disparities[-1], params.technique)