OpenCV Projects (C++ | CMake)
A curated collection of foundational computer vision projects built using OpenCV (C++) and CMake, focused on real-time processing, classical vision pipelines, and correct project structuring.
These projects are intentionally designed to:
-
Emphasize core OpenCV concepts
-
Avoid black-box abstractions
-
Be buildable, debuggable, and extensible
-
Help beginners understand why things work, not just that they work
π Project Overview OpenCV_Projects/ β βββ projects/ β βββ Color_Picker/ β βββ Virtual_Painter/ β βββ Documents_Scanner/ β βββ Russian_Number_Plate_Detector/ β βββ README.md
Each project is self-contained and follows the same structure:
<Project_Name>/ βββ CMakeLists.txt βββ src/ β βββ main.cpp βββ Resources/ (only when required)
π§ Build Requirements
-
C++17 or later
-
OpenCV β₯ 4.x
-
CMake β₯ 3.16
-
Windows / Linux (tested on Windows with MSVC)
Make sure OpenCV binaries are available in your system PATH (Windows users).
π¦ 1. Color Picker Purpose
Interactively identify HSV color ranges from a live camera feed using trackbars.
Key Concepts
-
BGR β HSV color space conversion
-
Real-time trackbars
-
Binary masking using inRange
-
Practical color calibration workflow
How It Works
-
Camera feed is converted to HSV
-
Trackbars control H, S, and V min/max values
-
Masked output updates live
-
Final HSV ranges are used by other projects (e.g. Virtual Painter)
Why This Project Matters
Color calibration is a prerequisite for many vision tasks. This project teaches how to do it correctly instead of guessing values.
ποΈ 2. Virtual Painter Purpose
Draw on a virtual canvas using a colored pen/marker tracked in real time.
Key Concepts
-
HSV-based object tracking
-
Contour detection
-
Centroid computation using moments
-
Persistent drawing using an overlay canvas
How It Works
-
HSV ranges (from Color Picker) isolate the pen color
-
Largest valid contour is selected
-
Contour center is tracked frame-to-frame
-
Lines are drawn on a separate canvas and blended with the frame
Design Notes
-
One canvas per session (no flickering)
-
Noise filtered via contour area threshold
-
Explicit handling of lost tracking frames
Limitations (Intentionally Left Visible)
-
HSV sensitivity to lighting
-
No Kalman filtering (kept simple on purpose)
π 3. Document Scanner Purpose
Simulate a mobile document scanning pipeline using classical image processing.
Key Concepts
-
Edge detection (Canny)
-
Morphological operations
-
Contour approximation
-
Perspective transformation
-
ROI cropping
Pipeline
-
Convert image to grayscale
-
Blur and detect edges
-
Dilate edges to strengthen contours
-
Detect largest quadrilateral contour
-
Apply perspective warp
-
Crop borders for clean output
Why This Is Important
This project demonstrates how geometry + image processing can solve real-world problems without deep learning.
Practical Notes
-
Resource paths are resolved at runtime
-
Designed to avoid hard-coded absolute paths
-
Easy to adapt for camera input later
π 4. Russian Number Plate Detector Purpose
Detect Russian vehicle number plates in real time using a webcam.
Key Concepts
-
Haar Cascade classifiers
-
XML-based object detection
-
Real-time video processing
-
Robust resource loading
How It Works
-
Webcam (VideoCapture(0)) provides frames
-
Haar cascade XML is loaded at runtime
-
Plates are detected using detectMultiScale
-
Bounding boxes are drawn live
Important Design Choice
This project uses classical Haar cascades deliberately:
-
Lightweight
-
No GPU required
-
Easy to understand
-
Suitable for embedded or low-resource systems
Known Limitations
-
Cascade performance depends on training data
-
Sensitive to extreme angles and lighting
-
Detection only (no OCR yet)