mirror of
https://github.com/artegoser/image-pluser-webui.git
synced 2025-02-22 20:23:15 +03:00
refactor: methods
This commit is contained in:
parent
3f1d13c1c0
commit
09346cb114
6 changed files with 35 additions and 24 deletions
|
@ -1,7 +1,7 @@
|
|||
import ffmpeg
|
||||
import os
|
||||
from processing.utils import generate_name, get_date_text, generate_name_with_file_name
|
||||
from methods.bulk_methods import edge, sharpen, canny_edge
|
||||
from methods.bulk_methods import methods_funcs
|
||||
|
||||
|
||||
def images_to_video(
|
||||
|
@ -31,12 +31,7 @@ def video_to_images(video_path, img_ext):
|
|||
|
||||
def bulk_processing(directory, out_directory, method):
|
||||
date = get_date_text()
|
||||
if method == "Edge detection":
|
||||
run_bulk(edge, directory, out_directory, date)
|
||||
elif method == "Canny edge detection":
|
||||
run_bulk(canny_edge, directory, out_directory, date)
|
||||
elif method == "Sharpen":
|
||||
run_bulk(sharpen, directory, out_directory, date)
|
||||
run_bulk(methods_funcs[method], directory, out_directory, date)
|
||||
|
||||
|
||||
def run_bulk(func, directory, out_directory, date):
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
from methods.stack_methods import denoise, startracks, noise_extractor, untrack
|
||||
from methods.stack_methods import (
|
||||
methods_funcs,
|
||||
)
|
||||
import os
|
||||
from processing.utils import generate_name
|
||||
|
||||
|
@ -6,16 +8,8 @@ from processing.utils import generate_name
|
|||
def stacking(dir, method):
|
||||
files = os.listdir(dir)
|
||||
files = list(map(lambda x: os.path.join(dir, x), files))
|
||||
files = list(filter(lambda x: x.endswith(".png"), files))
|
||||
|
||||
if method == "denoise":
|
||||
img = denoise(files)
|
||||
elif method == "startracks":
|
||||
img = startracks(files)
|
||||
elif method == "noise extractor":
|
||||
img = noise_extractor(files)
|
||||
elif method == "untrack":
|
||||
img = untrack(files)
|
||||
img = methods_funcs[method](files)
|
||||
|
||||
name = generate_name()
|
||||
img.save(name)
|
||||
|
|
Loading…
Add table
Reference in a new issue