This repository provides an introduction to image processing and understanding using OpenCV with Python. OpenCV is an open-source computer vision library that allows for real-time image and video processing, making it widely used in fields such as robotics, AI, and medical imaging.
Ensure you have Python installed on your system before proceeding. It is recommended to use Python 3.6 or later.
-
Image Smoothing / Blurring Filters using OpenCV
- Averaging (Lowpass) filter with
cv2.filter2D
- Box filter with
cv2.boxFilter
- Simple blur with
cv2.blur
- Median filter with
cv2.medianBlur
(good for salt-and-pepper noise) - Gaussian filter with
cv2.GaussianBlur
- Averaging (Lowpass) filter with
-
Noise Removal Techniques
- Salt noise removal using Min Filter (PIL)
- Pepper noise removal using Max Filter (PIL)
- Both Salt & Pepper noise removal using Median Filter
-
PIL-Based Image Processing
ImageFilter.MinFilter
andImageFilter.MaxFilter
- Grayscale conversion using
ImageOps.grayscale
- Edge detection using
ImageFilter.FIND_EDGES
-
Edge Detection
- Sobel operator using
cv2.Sobel
(X and Y derivatives) - Laplacian operator using
cv2.Laplacian
- Laplacian of Gaussian (LoG): combining Gaussian blur + Laplacian
- Sobel operator using
-
Histogram Equalization
- Improve contrast of:
- Dark images
- Bright images
- Low contrast images
- Improve contrast of:
-
Image Transformations
- Negative Transformation (invert pixel values)
- Power-Law (Gamma) Transformation for brightness correction
To set up your environment, install the required dependencies using pip:
pip install opencv-python
pip install matplotlib
python -m pip install jupyter
To start working with Jupyter Notebook, run the following command:
python -m notebook
This will open Jupyter Notebook in your web browser, allowing you to execute and visualize OpenCV-based image processing scripts.
Here are some essential Jupyter Notebook keyboard shortcuts to improve efficiency:
Shift + Enter
→ Run the current cell and move to the nextCtrl + Enter
→ Run the current cell but stay on itAlt + Enter
→ Run the current cell and insert a new one belowEsc + A
→ Insert a new cell aboveEsc + B
→ Insert a new cell belowEsc + D + D
→ Delete the selected cellEsc + M
→ Convert cell to MarkdownEsc + Y
→ Convert cell to CodeEsc + L
→ Toggle line numbers in cellEsc + H
→ Show help menu
Up/Down Arrow
→ Move between cellsCtrl + Shift + -
→ Split a cell at the cursorShift + Tab
→ Show tooltip for functionsCtrl + Shift + P
→ Open command palette
Contributions are welcome! Feel free to submit issues or pull requests to enhance this repository.
This project is licensed under the MIT License. See the LICENSE
file for more details.