def setUp(self): # we open the sheets # we get the hash table with correspondences self.fields_correspondences = get_correspondences() pass
import pyexcel as pe from correspondences import get_correspondences def process_english_db(fields_correspondences, filename="data/bd-inglesa.xlsx"): ## Read the sheet (we need to specify the correct sheet of the book) sheet = pe.get_sheet(file_name=filename, sheet_name="Proximates") # Get field names row_names = sheet.row[0] n_fields = len(row_names) for i in range(n_fields): row_names[i] = fields_correspondences[row_names[i]] # Save all the changes sheet.row[0] = row_names sheet.save_as("data/processed-english-db.xlsx") pass if __name__ == "__main__": fields_correspondences = get_correspondences() process_english_db(fields_correspondences)
# driver function if __name__ == "__main__": DEBUG = False if len(sys.argv) > 1: if sys.argv[1] == 'debug': DEBUG == True if not DEBUG: image1_path = get_image_path("Select first image") image2_path = get_image_path("Select second image") dialog = mb.askyesno( 'Mark Points', 'Mark points on images?(No: Load from text file)') if dialog: first_image_positions, second_image_positions = get_correspondences( image1_path, image2_path) else: root = tk.Tk() dummy = root.withdraw() points_path = filedialog.askopenfilename( initialdir=".", title='Load points file', filetypes=(("all files", "*.*"), ("png files", "*.png"), ("txt files", "*.txt"))) first_image_positions, second_image_positions = load_correspondences( points_path) stitched_image = stitch_image(image1_path, image2_path, first_image_positions, second_image_positions)