MCPcopy Create free account
hub / github.com/LCBOWER33/StegoScan / enhance_image_for_ocr

Function enhance_image_for_ocr

StegoScan.py:723–735  ·  view source on GitHub ↗

Prepares the image to improve OCR accuracy.

(image)

Source from the content-addressed store, hash-verified

721
722
723def enhance_image_for_ocr(image):
724 """Prepares the image to improve OCR accuracy."""
725 # Convert to grayscale
726 gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
727
728 # Apply adaptive histogram equalization to enhance contrast
729 clahe = cv2.createCLAHE(clipLimit=3.0, tileGridSize=(8, 8))
730 enhanced = clahe.apply(gray)
731
732 # Resize to a standard size (helps OCR model generalize better)
733 resized = cv2.resize(enhanced, (512, 512))
734
735 return resized
736
737
738def detect_text(image):

Callers 1

detect_textFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected