Image Analysis with OpenCV
Introduction
This project is part of my engineering coursework, where I am learning to use the OpenCV library with the C++ programming language. The course is designed to introduce us to the fundamentals of computer vision, gradually presenting OpenCV's features and their practical applications.
The course includes 40 videos provided by the professor, covering a wide range of topics such as image manipulation, histogram calculations, color analysis, and contour detection. Throughout these videos, concepts are introduced step by step, with clear examples to understand the usage of OpenCV's functions.
In addition to the videos, three practical assignments allow us to implement the skills learned. The final assignment, which is the most complex, focuses on contour detection and integrates both theoretical and practical aspects.
Course Structure: What I’m Learning
Here is an overview of the main topics covered in this course:
Introduction to OpenCV :
Loading and displaying images.
Exploring OpenCV’s fundamental data structures.
Pixel Manipulation :
Various methods to scan and process individual pixels in an image.
Implementing basic operations to modify or analyze pixels.
Color Processing :
Concepts related to color spaces and their applications in computer vision.
Using OpenCV tools to transform colors and detect objects based on color.
Pixel Analysis with Histograms :
Calculating and interpreting image histograms.
Practical applications of histograms for image enhancement or anomaly detection.
Accessing the Results and Code
The last assignment of the course (Assignment 03) involved comparing three edge detection algorithms: Sobel, Laplace, and Canny. The objective was to evaluate their performance on a dataset of 40 images following these steps:
Apply each detector to extract edges from the images.
Adjust key parameters (kernel size, thresholds) and observe their impact on the results.
Add interactive trackbars to dynamically modify the parameters and optimize the detection.
Compare the obtained results with manually drawn reference edges.
Quantitatively evaluate the performance of each detector using metrics such as false positive rate, false negative rate, and an overall performance score.
To further refine the analysis and enhance the project, I extended the code by adding a feature that automatically explores different parameter combinations for each detector and each image. This addition identifies the optimal parameters to maximize edge detection accuracy. Although this approach was not required for the assignment, it allowed me to fine-tune the detectors’ performance.
Once the analysis was completed, a detailed report was written, outlining the methodology, results, and performance interpretation for each detector.
You can download the full report by clicking the button below (in French).
Final Assignment: Edge Detection
All project details, including the results and source code, are available in my GitHub repository. You will find:
The complete code from the video tutorials, providing a hands-on approach to learning computer vision with OpenCV.
The implementations of the three assignments, including the final project on edge detection, comparing Sobel, Laplace, and Canny detectors.
Test results and a performance evaluation of each detector.
CSV files containing the optimized parameters for each edge detection method.
You can access the GitHub repository by clicking the button below.
Code Explanation and Program Structure
The program (available on my GitHub repository in the Assignment 03 folder) is structured into multiple files to ensure modularity and ease of analysis:
DetecteurContours: Implements functions for applying Sobel, Laplace, and Canny edge detectors to a given image.
EvaluateurContours: Evaluates the performance of detected edges by comparing them to manually created reference contours.
MeilleursParametres: Automatically optimizes the parameters for each method.
Affichage: Manages image display and user interaction via trackbars.
Fonctions: Contains utility functions such as image loading and filter application.
The program was designed to be interactive, allowing the user to dynamically explore and compare different edge detection methods.