From 26702d57f1d621be700901e496e03f0973ec97d4 Mon Sep 17 00:00:00 2001 From: Artemy Date: Mon, 17 Apr 2023 18:46:59 +0300 Subject: [PATCH] perf: The real mean between images and the acceleration of denoise processing --- methods/stack_methods.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/methods/stack_methods.py b/methods/stack_methods.py index fe10240..17f7e7d 100644 --- a/methods/stack_methods.py +++ b/methods/stack_methods.py @@ -1,21 +1,11 @@ from PIL import Image, ImageChops from tqdm import tqdm +import numpy as np def denoise(files): - bias = 1 - image = Image.open(files[0]) - for file in tqdm(files): - alpha = 1 / bias - - im2 = Image.open(file) - im3 = Image.blend(image, im2, alpha) - - image = im3 - - bias += 1 - - return image + images = [np.asarray(Image.open(file)) for file in tqdm(files)] + return Image.fromarray(np.uint8(np.mean(images, axis=0))) def startracks(files):