Umbau
This commit is contained in:
@@ -52,16 +52,16 @@ def preprocess_image(image, debug_dir):
|
||||
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
|
||||
enhanced = clahe.apply(gray)
|
||||
denoised = cv2.fastNlMeansDenoising(enhanced)
|
||||
_, binary = cv2.threshold(denoised, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
|
||||
# _, binary = cv2.threshold(denoised, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
|
||||
|
||||
# Speichern der Zwischenergebnisse im spezifischen Verzeichnis
|
||||
cv2.imwrite(os.path.join(debug_dir, 'gray.png'), gray)
|
||||
cv2.imwrite(os.path.join(debug_dir, 'enhanced.png'), enhanced)
|
||||
cv2.imwrite(os.path.join(debug_dir, 'denoised.png'), denoised)
|
||||
cv2.imwrite(os.path.join(debug_dir, 'binary.png'), binary)
|
||||
# cv2.imwrite(os.path.join(debug_dir, 'binary.png'), binary)
|
||||
|
||||
logger.info(f"Debug images saved in: {debug_dir}")
|
||||
return binary
|
||||
return denoised
|
||||
except Exception as e:
|
||||
logger.error(f"Preprocessing error: {str(e)}")
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user