An open API service indexing awesome lists of open source software.

https://github.com/prajwalamte/image-filters-using-python

Applying different filters to image using OpenCV, Numpy and Matplotlib libraries of Python
https://github.com/prajwalamte/image-filters-using-python

Last synced: 10 days ago
JSON representation

Applying different filters to image using OpenCV, Numpy and Matplotlib libraries of Python

Awesome Lists containing this project

README

          

# Image Filtering Using OpenCV

A Python application for applying various image filters to images using computer vision techniques. This project was created during 2nd year of Engineering as part of a coursework assignment.

## Project Overview

This program demonstrates fundamental image processing concepts using OpenCV, including kernel-based filtering and color space transformations. It provides an interactive CLI interface for applying different effects to images.

## Features

- **Multiple Filter Effects**: Apply various artistic and processing filters
- **Emboss**: Creates a 3D embossed effect
- **Sharpen**: Enhances edges and details
- **Blur**: Applies Gaussian blur with customizable intensity
- **Sepia**: Adds a warm, vintage tone
- **Interactive CLI**: Simple menu-driven interface
- **Side-by-side Comparison**: View original and filtered images together
- **Real-time Visualization**: Uses Matplotlib for immediate feedback

## Requirements

- Python 3.7+
- OpenCV (`opencv-python`)
- Matplotlib
- NumPy
- Seaborn

## Installation

1. Clone the repository to your local machine:
```bash
git clone https://github.com/yourusername/Image-Filters-using-Python.git
cd Image-Filters-using-Python
```

2. Install the required dependencies:
```bash
pip install -r requirements.txt
```

Or install manually:
```bash
pip install opencv-python matplotlib numpy seaborn
```

## Usage

1. Place your image file in the project directory (update filename in `main.py` if needed)
2. Run the program:
```bash
python main.py
```

3. Select a filter from the menu:
- Enter `1` for Emboss
- Enter `2` for Sharpen
- Enter `3` for Blur
- Enter `4` for Sepia

4. The filtered image will be displayed in a new window alongside the original

## Sample Outputs

### Original Image
![Original Image](examples/original.png)

### Filter Results

| Emboss | Sharpen |
|--------|---------|
| ![Emboss](examples/emboss.png) | ![Sharpen](examples/sharpen.png) |

| Blur | Sepia |
|------|-------|
| ![Blur](examples/blur.png) | ![Sepia](examples/sepia.png) |

## Code Structure

- `main.py`: Main application with all filter implementations
- Filter functions use NumPy kernels and OpenCV's `filter2D()` and transformation functions
- Modular design allows easy addition of new filters

## Learning Outcomes

This project helped me understand:
- Image processing fundamentals and kernel-based filtering
- Color space conversions (BGR to RGB)
- OpenCV library usage and APIs
- Python best practices (type hints, docstrings, error handling)

For more details, see [Learning.md](Learning.md)

## License

This project is open source and available under the MIT License.