A computer vision pipeline to digitize scanned engineering drawing papers by detecting and classifying solid and dashed lines after removing the background mesh or grid. Built with OpenCV and Python for a project under Prof. Kaushal Bhagat (IIT Kharagpur).
Overview
Scanned engineering drawings often include a mesh or grid background that obscures line features. This project preprocesses such images, removes the mesh using clustering and thresholding, and applies edge detection followed by the Hough Line Transform to detect and visually distinguish solid lines (e.g., object outlines) from dashed lines (e.g., hidden or construction lines).
Pipeline
The pipeline loads and preprocesses the image, crops and splits it into question and answer regions, applies K-means (K=2) on pixel intensities in the question region to segment and remove the mesh, uses threshold-based cleanup in the answer region, then merges and binarizes. Gaussian blur and Canny edge detection with auto-computed thresholds follow; morphological operations (dilate and erode) reduce noise and connect broken edges. The Probabilistic Hough Line Transform detects line segments and classifies them by length (long โ solid, short โ dashed), with output drawn as solid lines in red and dashed in green.
Tech Stack
Python, OpenCV, NumPy, scikit-learn (K-means), and optional Matplotlib for visualization. The script was developed in Google Colab with optional display support for local runs.