[Python] How can I accurately detect and remove skewed border lines in scanned handwritten...

Discussão em 'Python' iniciado por Stack, Maio 19, 2025.

  1. Stack

    Stack Membro Participativo

    I have a question. Has anyone worked on an OCR-related project? I’m trying to remove unnecessary problem borders and images from a scanned PDF of handwritten math problem solutions. The scans weren’t done by a machine but by hand, so each scan is slightly skewed, making it difficult to detect the borders. If anyone has had a similar experience, could you share some hints?

    enter image description here The attached image is a schematic of the scanned image. Inside the dashed area are the problem statement, diagrams, and handwritten solutions. Since the handwriting often extends beyond the dashed or solid borders, detecting the borders reliably is challenging.

    I tried using OpenCV(opencv-python==3.11.0.86)’s HoughLinesP method to detect and erase the solid lines, but the detection wasn’t always accurate.

    FYI, I am familiar with Python and the base code was written by cursorAI

    OS: macOS Sequoia 15.4.1

    python: 3.11.12

    image size: roughly 70005000 (Heightwidth)

    image color model: RGB (most images)

    Continue reading...

Compartilhe esta Página