mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 09:05:30 +00:00
template für gelben hintergrund
This commit is contained in:
@@ -10,6 +10,7 @@ import numpy as np
|
|||||||
from PIL import Image, ImageEnhance
|
from PIL import Image, ImageEnhance
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
@@ -289,10 +290,21 @@ if __name__ == "__main__":
|
|||||||
choices=['denoise', 'contrast', 'background', 'sharpen'],
|
choices=['denoise', 'contrast', 'background', 'sharpen'],
|
||||||
default=['denoise', 'contrast', 'background', 'sharpen'],
|
default=['denoise', 'contrast', 'background', 'sharpen'],
|
||||||
help="Processing steps to apply")
|
help="Processing steps to apply")
|
||||||
|
parser.add_argument("--config", help="JSON config file with custom parameters")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
cleaner = NewspaperImageCleaner()
|
# Load config if provided
|
||||||
|
config = None
|
||||||
|
if args.config and os.path.exists(args.config):
|
||||||
|
with open(args.config, 'r') as f:
|
||||||
|
config = json.load(f)
|
||||||
|
# Convert list back to tuple if needed
|
||||||
|
if config and 'clahe_grid_size' in config:
|
||||||
|
config['clahe_grid_size'] = tuple(config['clahe_grid_size'])
|
||||||
|
print(f"Loaded config from: {args.config}")
|
||||||
|
|
||||||
|
cleaner = NewspaperImageCleaner(config)
|
||||||
|
|
||||||
if args.directory:
|
if args.directory:
|
||||||
output_dir = args.output or "cleaned_images"
|
output_dir = args.output or "cleaned_images"
|
||||||
|
|||||||
12
scripts/ex/light_config.json
Normal file
12
scripts/ex/light_config.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"bilateral_d": 3,
|
||||||
|
"bilateral_sigma_color": 50,
|
||||||
|
"bilateral_sigma_space": 30,
|
||||||
|
"denoise_h": 3,
|
||||||
|
"morph_kernel_size": 1,
|
||||||
|
"clahe_clip_limit": 1.2,
|
||||||
|
"gamma": 1.05,
|
||||||
|
"unsharp_amount": 1.1,
|
||||||
|
"unsharp_radius": 0.8,
|
||||||
|
"unsharp_threshold": 0
|
||||||
|
}
|
||||||
12
scripts/ex/smooth_yellow_config.json
Normal file
12
scripts/ex/smooth_yellow_config.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"bilateral_d": 7,
|
||||||
|
"bilateral_sigma_color": 100,
|
||||||
|
"bilateral_sigma_space": 40,
|
||||||
|
"denoise_h": 4,
|
||||||
|
"morph_kernel_size": 1,
|
||||||
|
"clahe_clip_limit": 1.0,
|
||||||
|
"gamma": 1.0,
|
||||||
|
"unsharp_amount": 1.2,
|
||||||
|
"unsharp_radius": 0.8,
|
||||||
|
"unsharp_threshold": 2
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user