python
15 lines · 1 tab
Dr. Elena Vasquez
Apr 2026
1 tab
import cv2
image = cv2.imread('receipt.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
thresholded = cv2.adaptiveThreshold(
blurred,
255,
cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
cv2.THRESH_BINARY,
11,
2,
)
cv2.imwrite('receipt_processed.png', thresholded)
1 file · python
Explain with highlit
A lot of computer vision performance comes from cleaner inputs rather than larger models. I use OpenCV for resizing, denoising, thresholding, and contour extraction when preparing images for OCR or downstream classification. These classical steps often save compute and improve stability.
Share this code
Here's the card — post it anywhere.