def preprocess_canny(_image_files): processed_images = [] for image_file in _image_files: img = imread(image_file) img = preprocess.autocrop(img) img = preprocess.scale_max(img) img = preprocess.make_square(img) img = preprocess.grey(img) img = preprocess.canny(img) processed_images.append(img) mosaic_images = mosaic((len(processed_images)), processed_images) return mosaic_images
def preprocess_super_simple(_image_files): processed_images = [] for image_file in _image_files: img = imread(image_file) img = preprocess.autocrop(img) img = preprocess.scale_max(img) img = preprocess.make_square(img) img = preprocess.blur( img, gaussian_blur={"enabled": True, "ksize_width": 5, "ksize_height": 5, "sigmaX": 0} ) img = preprocess.grey(img) img = preprocess.bitwise(img) processed_images.append(img) mosaic_image = mosaic(len(processed_images), processed_images) return mosaic_image
def acquire_img(img_id, path): """Retrieve and process img from folder. Retrieve image from folder, scale it, applies grayscale, and reshape it to (1, 100, 100) Args: img_id (str): path (str): Returns: numpy.array: img array """ img_path = get_img_file_path(img_id, path) img = imread(img_path) img_gray = preprocess.grey(img) img_resized = preprocess.scale_max(img_gray, IMG_SIZE, IMG_SIZE) img_reshaped = np.reshape(img_resized, (1, 100, 100)) return img_reshaped
def preprocess_super_simple(_image_files): processed_images = [] for image_file in _image_files: img = imread(image_file) img = preprocess.autocrop(img) img = preprocess.scale_max(img) img = preprocess.make_square(img) img = preprocess.blur(img, gaussian_blur={ "enabled": True, "ksize_width": 5, "ksize_height": 5, "sigmaX": 0 }) img = preprocess.grey(img) img = preprocess.bitwise(img) processed_images.append(img) mosaic_image = mosaic(len(processed_images), processed_images) return mosaic_image