def resize_to_cell_size(the_ragion, interpolation = cv2.INTER_AREA): # the_ragion.shape.pl() heighted_ragion = Image.resize_keeping_ratio_by_fixed_length(the_ragion, IMG_SIZE, interpolation) # heighted_ragion.shape.pl() standard_ragion = Ragion.fill(heighted_ragion,(IMG_SIZE,IMG_SIZE)) # standard_ragion.shape.pl() return standard_ragion
def identify_wrong_number(number_ragions, difference, show_actual=True): all_number_images = generate_number_images() identified_number_ragions = number_ragions[:] for index,_,actual in difference: height, width = number_ragions[index].shape if show_actual: number_ragions[index] = Image.resize_keeping_ratio_by_height(all_number_images[actual], height) height, width = number_ragions[index].shape identified_number_ragions[index] = Ragion.fill(number_ragions[index], (height+2, width+2), 1) return identified_number_ragions
def resize_to_cell_size(the_ragion): heighted_ragion = resize_keeping_ratio_by_height(the_ragion, IMG_SIZE) standard_ragion = Ragion.fill(heighted_ragion, (IMG_SIZE, IMG_SIZE)) return standard_ragion