def main(): data_path = 'val2014' save_path = 'test_data/cross_dissolve_data' all_imname = cocotools.get_all_images(data_path) generate_random = 10 for i in range(generate_random): id1 = cocotools.get_cocoid(random.choice(all_imname)) id2 = cocotools.get_cocoid(random.choice(all_imname)) im1 = cocotools.get_image_plt(data_path, id1) im2 = cocotools.get_image_plt(data_path, id2) if np.shape(im1) != np.shape(im2): print "Shape does not match" im1, im2 = cocotools.reshape_crop(im1,im2) file_path = os.path.join(save_path,cocotools.get_filename(id1,False) + '_' + str(id2).zfill(12)) generate_cross_dissolve(im1,im2, file_path) return
def main(): search_id_pairs = [[15581,86840],[436603, 446359]] #Find the image id you decided to use data_path = 'val2014' save_path = 'test_data/morph_data/' run_morph = False run_structural_morph = True for id_pair in search_id_pairs: im1 = cocotools.get_image_plt(data_path, id_pair[0]) im2 = cocotools.get_image_plt(data_path, id_pair[1]) if np.shape(im1) != np.shape(im2): print "Shape does not match" im1, im2 = cocotools.reshape_crop(im1,im2) if run_morph: file_name = cocotools.get_filename(id_pair[0], False) + '_' + str(id_pair[1]).zfill(12) generate_morph(im1,im2, file_name, save_path) if run_structural_morph: file_name = cocotools.get_filename(id_pair[0], False) + '_' + str(id_pair[1]).zfill(12) generate_structural_morph(im1,im2, file_name, save_path + '/structural_morph') """ for a in cocotools.find_annotation(id): print a """ break return