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 image_raw_preprocessing(img_stream): """Decode the raw data from url into an image, crops and makes square :param img_stream: raw data from url :return: processed img """ image_squared = None image_decoded = imdecode(np.fromstring(img_stream.content, np.uint8), flags=IMREAD_COLOR) if image_decoded is not None: try: image_autocropped = preprocess.autocrop(image_decoded) except AttributeError as e: LOGGER.error(e) return image_squared if image_autocropped is not None: image_scaled_max = preprocess.scale_max(image_autocropped) image_squared = preprocess.make_square(image_scaled_max) return image_squared
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 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