示例#1
0
sim_value = '%s%s_exp_sim.tiff'%(f_path, core_name1)
var_flow = '%s%s_exp_var.flo'%(f_path, core_name1)
#Obtain the matches' list for both (I0-I1 and I1-I0)
print('Obtaining list of matches from DeepMatching')
max_scale = math.sqrt(2)
#I0-I1
#param = '%s %s -downscale 1 -max_scale %s -rot_range -45 +45 > %s'%(im_name1, im_name2, max_scale, match_name_1)
#command_line = '%s %s\n'%(match_comparison, param)
#os.system(command_line)
#I1-I0
#param = '%s %s -downscale 1 -max_scale %s -rot_range -45 +45 > %s'%(im_name2, im_name1, max_scale, match_name_2)
#command_line = '%s %s\n'%(match_comparison, param)
#os.system(command_line)
#Create a sparse flow from the deepmatching matches.
print('Creating sparse from matches')
param = '%s %s %s %s\n'%(cut(delete(confi(im_name1, im_name2, match_name_1, f_path), threshold)), width_im, height_im, sparse_name_1)
command_line = '%s %s\n'%(sparse_flow, param)
os.system(command_line)
param = '%s %s %s %s\n'%(cut(delete(confi(im_name2, im_name1, match_name_2, f_path), threshold)), width_im, height_im, sparse_name_2)
command_line = '%s %s\n'%(sparse_flow, param)
os.system(command_line)
#Create a dense flow from a sparse set of initial seeds
print('Computing local faldoi')
options = '-m %s -wr %s'%(var_m, windows_radio)
param = '%s %s %s %s %s %s %s\n'%(im_name1, im_name2, sparse_name_1,sparse_name_2, 
                            region_growing, sim_value, options)
#print param
command_line = '%s %s\n'%(match_propagation, param)
os.system(command_line)
#Put the dense flow as input for a variational method
print('Computing global faldoi')
示例#2
0
    # os.system(command_line)

    # Elapsed time (deep matches)
    matches_timer = time.time()
    print("Computing matches btw. I0 and I1 ('./deepmatching') took {} secs.".
          format(matches_timer - load_timer))

else:
    # Need the timer anyway to compute the rest of relative values!
    matches_timer = time.time()

# Create a sparse flow from the deep matches.
if sparse_flow:
    param_fwd = "{} {} {} {}\n".format(
        cut(delete(confi(im_name0, im_name1, match_name_1, f_path),
                   threshold)), width_im, height_im, sparse_name_1)
    command_line_fwd = "{} {}\n".format(sparse_flow, param_fwd)
    # os.system(command_line)
    param_bwd = "{} {} {} {}\n".format(
        cut(delete(confi(im_name1, im_name0, match_name_2, f_path),
                   threshold)), width_im, height_im, sparse_name_2)
    command_line_bwd = "{} {}\n".format(sparse_flow, param_bwd)
    # os.system(command_line)
    # Execute in parallel
    # Define processes to be run in parallel
    commands = (command_line_fwd, command_line_bwd)

    # Create pool of processes to be executed and map them to a thread
    pool = multiprocessing.Pool(processes=2)
    pool.map(run_process, commands)
示例#3
0
    # Elapsed time (deep matches)
    matches_timer = time.time()
    print("Computing matches btw. I0 and I1 ('./deepmatching') took {} secs.".format(matches_timer - load_timer))

else:
    # Need the timer anyway to compute the rest of relative values!
    matches_timer = time.time()

# Create a sparse flow from the deep matches.
if sparse_flow_flag:
 	# To compute sparse flow from pre-computed matches: uncomment next 4 lines and comment the 2 below them
    # matches_fname = "{}_saliency_out_cut.txt".format(match_name_1[:-4])
    # matches_bwd_fname = "{}_saliency_out_cut.txt".format(match_name_2[:-4])
    # param_fwd = "{} {} {} {}\n".format(matches_fname, width_im, height_im, sparse_name_1)
    # param_bwd = "{} {} {} {}\n".format(matches_bwd_fname, width_im, height_im, sparse_name_2)
    param_fwd = "{} {} {} {}\n".format(cut(delete(confi(im_name0, im_name1, match_name_1, f_path), threshold)),
                                       width_im, height_im, sparse_name_1)
    param_bwd = "{} {} {} {}\n".format(cut(delete(confi(im_name1, im_name0, match_name_2, f_path),threshold)),
                                       width_im, height_im, sparse_name_2)
    command_line_fwd = "{} {}\n".format(sparse_flow, param_fwd)
    command_line_bwd = "{} {}\n".format(sparse_flow, param_bwd)
    # Execute in parallel
    # Define processes to be run in parallel
    commands = (command_line_fwd, command_line_bwd)

    # Create pool of processes to be executed and map them to a thread
    pool = multiprocessing.Pool(processes=2)
    pool.map(run_process, commands)

    # Elapsed time (sparse flow from matches)
    sparse_timer = time.time()
#I0-I1
param = '%s %s -downscale 1 -max_scale %s -rot_range -45 +45 > %s'%(im_name0, im_name1, max_scale, match_name_1)
command_line = '%s %s\n'%(match_comparison, param)

if matchings:
	os.system(command_line)

#I1-I0
param = '%s %s -downscale 1 -max_scale %s -rot_range -45 +45 > %s'%(im_name1, im_name0, max_scale, match_name_2)
command_line = '%s %s\n'%(match_comparison, param)

if matchings:
	os.system(command_line)

cut(delete(confi(im_name0, im_name1, match_name_1, f_path), threshold))
cut(delete(confi(im_name1, im_name0, match_name_2, f_path), threshold))

#Create a sparse flow from the deepmatching matches.

param = '%s %s %s %s\n'%(sparse_in1, width_im, height_im, sparse_name_1)
command_line = '%s %s\n'%(sparse_flow, param)
if sparse_flow:
	print('Creating sparse from matches')
	os.system(command_line)

param = '%s %s %s %s\n'%(sparse_in2, width_im, height_im, sparse_name_2)
command_line = '%s %s\n'%(sparse_flow, param)

if sparse_flow:
	os.system(command_line)