db_L_idx = str(idx_d).zfill(6) + "_L.png" db_R_idx = str(idx_d).zfill(6) + "_R.png" images_to_process_train[2 * i] = os.path.join(db_dir, db_L_idx) images_to_process_train[2 * i + 1] = os.path.join(db_dir, db_R_idx) i += 1 # images_to_process_test = [] # for idx_img in range(number_of_imgs): # images_to_process_test.append(query_L_path[idx_q * number_of_imgs + idx_img]) # images_to_process_test.append(query_R_path[idx_q * number_of_imgs + idx_img]) # 3-2. Select db images by location of result of step 2 # 3-3. Select db images by graph of result of step 2 # 4. Align photos print("Align photos") ba_api = BA_api() cam_L, eo_L, cam_R, eo_R = ba_api.alignphotos_3_2( images_to_process_train, query_L_label, query_R_label, number_of_imgs, seq, region) query_L_label = query_L_label[0].split( "\\")[1] + "/" + query_L_label[0].split("\\")[2] query_R_label = query_R_label[0].split( "\\")[1] + "/" + query_R_label[0].split("\\")[2] if len(eo_L) == 0 or len(eo_R) == 0: # No value f.write(query_L_label + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + query_R_label + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "\n")
images_to_process = ["" for i in range(seq * 2)] # test for idx_d in range(db_imgs[idx_q] - seq, db_imgs[idx_q] + seq): db_idx = str(idx_d).zfill(6) + ".png" # images_to_process[2*i] = os.path.join(db_L_dir, db_idx) # images_to_process[2*i+1] = os.path.join(db_R_dir, db_idx) images_to_process[i] = os.path.join(db_L_dir, db_idx) i += 1 images_to_process.append(query_L_path[idx_q]) images_to_process.append(query_R_path[idx_q]) # 3-2. Select db images by location of result of step 2 # 3-3. Select db images by graph of result of step 2 # 4. Align photos print("Align photos") ba_api = BA_api() cam_L, eo_L, cam_R, eo_R = ba_api.alignphotos_1( images_to_process, region) if len(eo_L) == 0 or len(eo_R) == 0: f.write(query_L_label + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + query_R_label + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "," + str(0) + "\n") else: f.write(query_L_label + "," + str(eo_L[0]) + "," + str(eo_L[1]) + "," + str(eo_L[2]) + "," + str(eo_L[3]) + "," + str(eo_L[4]) + "," + str(eo_L[5]) + "," + str(eo_L[6]) + "," + str(eo_L[7]) + "," + str(eo_L[8]) + "," +