template für gelben hintergrund

This commit is contained in:
Simon Martens
2025-09-15 18:39:48 +02:00
parent 9960dc5e38
commit 3ebfcd410f
3 changed files with 37 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import numpy as np
from PIL import Image, ImageEnhance
import os
import argparse
import json
from pathlib import Path
@@ -289,10 +290,21 @@ if __name__ == "__main__":
choices=['denoise', 'contrast', 'background', 'sharpen'],
default=['denoise', 'contrast', 'background', 'sharpen'],
help="Processing steps to apply")
parser.add_argument("--config", help="JSON config file with custom parameters")
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:
output_dir = args.output or "cleaned_images"

View 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
}

View 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
}