clahe
SKILL.md
clahe
CLAHE (Contrast Limited Adaptive Histogram Equalization) mejora el contraste local del documento, haciendo el texto más legible para OCR sin sobre-amplificar el ruido.
When to use
Aplicar después de la corrección de perspectiva, antes de OCR y face extraction.
Instructions
- Convertir imagen a espacio LAB:
lab = cv2.cvtColor(warped, cv2.COLOR_BGR2LAB). - Extraer canal L:
l, a, b = cv2.split(lab). - Aplicar CLAHE al canal L:
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8)).l_enhanced = clahe.apply(l). - Reconstruir imagen:
enhanced = cv2.merge([l_enhanced, a, b]).result = cv2.cvtColor(enhanced, cv2.COLOR_LAB2BGR). - Para OCR, convertir adicionalmente a escala de grises y binarizar con Otsu:
_, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU).
Notes
clipLimit=2.0evita sobre-amplificación de ruido; ajustar si el documento tiene sombras severas.tileGridSize=(8,8)funciona bien para documentos A4/ID-1; ajustar para otros tamaños.
Weekly Installs
9
Repository
davidcastagnetoa/skillsFirst Seen
14 days ago
Security Audits
Installed on
trae9
antigravity9
claude-code9
github-copilot9
codex9
kimi-cli9