Example #1
0
    # 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 (matches)
    matches_timer = time.time()
    print("Computing matches btw. I0 & I1 ('./match_cli') took {}".format(
        matches_timer - desc_timer))

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

# Create a sparse flow from the sift matches.
if sparse_flow_val:
    param = "{} {} {} {}".format(cut(match_name_1), width_im, height_im,
                                 sparse_name_1)

    # If we use custom matches that are already filtered, cut needs to be avoided
    # param = "{} {} {} {}".format(match_name_1, width_im, height_im, sparse_name_1)
    command_line = "{} {}".format(sparse_flow, param)
    os.system(command_line)
    # Create a sparse flow from the sift matches (img I1).
    param = "{} {} {} {}".format(cut(match_name_2), width_im, height_im,
                                 sparse_name_2)
    # param = "{} {} {} {}".format(match_name_2, width_im, height_im, sparse_name_2)
    command_line = "{} {}".format(sparse_flow, param)
    os.system(command_line)
    # Elapsed time (create sparse flow from SIFT matches)
    sparse_timer = time.time()
    print("Computing sparse flow from SIFT matches ('./sparse_flow') took {}".
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')
Example #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()
Example #4
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)
Example #5
0
sim_value = '%s%s_sift_sim.tiff' % (f_path, core_name1)
var_flow = '%s%s_sift_var.flo' % (f_path, core_name1)
# Obtain the matches' list for both (I0-I1 and I1-I0)
#Initial seeds (SIFT descriptors)
command_line = '%s %s %s\n' % (feature_descriptor, im_name1, param_sif)
print command_line
# exe_prog(command_line, desc_name_1)
command_line = '%s %s %s\n' % (feature_descriptor, im_name2, param_sif)
# exe_prog(command_line, desc_name_2)
#Obtain the matches' list
command_line = '%s %s %s\n' % (match_comparison, desc_name_1, desc_name_2)
exe_prog(command_line, match_name_1)
command_line = '%s %s %s\n' % (match_comparison, desc_name_2, desc_name_1)
# exe_prog(command_line, match_name_2)
#Create a sparse flow from the sift matches.
param = '%s %s %s %s\n' % (cut(match_name_1), width_im, height_im,
                           sparse_name_1)
command_line = '%s %s\n' % (sparse_flow, param)
# os.system(command_line)
#Create a sparse flow from the sift matches.
param = '%s %s %s %s\n' % (cut(match_name_2), 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
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)
#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)