A comprehensive demonstration of OpenCV capabilities in C++, showcasing image processing, drawing operations, and webcam capture.
- Image Processing: Grayscale conversion, Gaussian blur, Canny edge detection
- Drawing Operations: Circles, rectangles, lines, polygons, and text
- Webcam Capture: Real-time video feed processing (optional)
- Custom Filter: Template for implementing your own image filters
sudo apt update
sudo apt install libopencv-dev cmake build-essentialbrew install opencv cmakesudo dnf install opencv-devel cmake gcc-c++mkdir build
cd build
cmake ..
make./opencv_demo- Press any key to advance through demos
- Press 'q' to quit
- In webcam mode: Press 'q' to exit webcam feed
The applyCustomFilter() function in main.cpp is left for you to implement! Try experimenting with:
- Bilateral filtering:
bilateralFilter() - Morphological operations:
erode(),dilate(),morphologyEx() - Color space conversions:
cvtColor()with different color spaces - Histogram equalization:
equalizeHist() - Image sharpening or embossing
- Custom kernels with
filter2D()
If you get "cannot open webcam" error, make sure:
- Your webcam is connected and not in use by another application
- You have permissions to access the webcam
- Try changing the camera index from
0to1or2inVideoCapture cap(0)