flask-ocr-api / app /preprocess.py
vamsi1103's picture
Upload 34 files
8619a66 verified
Raw History Blame Contribute Delete
352 Bytes
import cv2
import numpy as np
def preprocess_image(image_np):
# RapidOCR utilizes DBNet for differentiable binarization text detection.
# We maintain color/grayscale channels and apply a gentle scaling to preserve edge clarity.
image_np = cv2.resize(image_np, None, fx=1.5, fy=1.5, interpolation=cv2.INTER_CUBIC)
return image_np