Skip to content

haydarkadioglu/simple-image-processing-application

Repository files navigation

SIPA - Simple Image Processing Application

A comprehensive educational tool for learning image processing fundamentals

🎯 Project Goal

This application is designed to provide a simple and intuitive platform for learning image processing concepts. All image processing functions are implemented from scratch using only NumPy, making it perfect for educational purposes and understanding the underlying algorithms.

✨ Key Features

🎨 Color Operations

  • RGB to Grayscale Conversion: Convert color images to grayscale using luminance formula
  • Binary Thresholding: Single and double threshold operations
  • RGB Channel Manipulation: Individual channel transformations
  • Contrast Enhancement: Adjustable contrast control

🔧 Filtering Operations

  • Noise Reduction: Mean and median filters
  • Edge Detection: Prewitt operator implementation
  • Image Sharpening: Unsharp masking technique
  • Noise Addition: Salt and pepper noise for testing

📊 Histogram Operations

  • Histogram Analysis: Calculate and display RGB/Grayscale histograms
  • Histogram Equalization: Improve image contrast automatically
  • Histogram Stretching: Enhance dynamic range

🔄 Geometric Transformations

  • Image Rotation: 90-degree clockwise rotation
  • Cropping: Select and extract image regions
  • Zooming: Scale images up or down

🧮 Morphological Operations

  • Erosion & Dilation: Basic morphological transformations
  • Opening & Closing: Combined operations for noise removal
  • Binary Image Processing: Optimized for binary images

➕ Arithmetic Operations

  • Image Addition: Weighted combination of two images
  • Image Division: Pixel-wise division operations

🚀 Installation & Usage

SIPA can be used in two different ways:

1. 📱 As a GUI Application (Recommended)

From PyPI

pip install sipa
sipa  # Launch GUI application

From Source

git clone https://github.com/haydarkadioglu/simple-image-processing-application.git
cd simple-image-processing-application
pip install -e .
sipa  # Launch GUI application

Direct Execution

# Clone the repository
git clone https://github.com/haydarkadioglu/simple-image-processing-application.git
cd simple-image-processing-application

# Install dependencies
pip install numpy matplotlib PyQt5 opencv-python

# Run directly
python main.py

2. 📚 As a Python Library

Modern Import Style (Recommended)

import sipa
import numpy as np

# Load your image as numpy array
image = np.array(...)  # Your image data (height, width, 3) for RGB

# Convert to grayscale
gray_image = sipa.Colors.convert_to_gray(image)

# Apply filters
filtered = sipa.Filters.mean_filter(gray_image, kernel_size=5)
median_filtered = sipa.Filters.median_filter(image, kernel_size=3)

# Detect edges
edges = sipa.Filters.detect_edge_prewitt(gray_image)

# Geometric transformations
rotated = sipa.Rotate.rotate_image(image)
cropped = sipa.Rotate.crop(image, x1=10, y1=10, x2=100, y2=100)
zoomed = sipa.Rotate.zoom(image, factor=2.0)

# Morphological operations (for binary images)
binary = sipa.Colors.convert_to_binary(gray_image, threshold=128)
eroded = sipa.Histogram.erode(binary, kernel_size=3)
dilated = sipa.Histogram.dilate(binary, kernel_size=3)

# Histogram operations
hist = sipa.Histogram.calculate_gray_histogram(gray_image)
equalized = sipa.Histogram.histogram_equalization(image)

Legacy Import Style (Backward Compatibility)

# For existing code that uses the old import structure
from Functions import SIP as sip
import numpy as np

image = np.array(...)  # Your image data

# Same functionality, old syntax
gray_image = sip.Colors.convert_to_gray(image)
filtered = sip.Filters.mean_filter(gray_image, 5)
edges = sip.Filters.detect_edge_prewitt(gray_image)

🎯 Quick Start Example

import sipa
import numpy as np
import matplotlib.pyplot as plt

# Create a test image
test_image = np.random.randint(0, 255, (100, 100, 3), dtype=np.uint8)

# Basic operations
gray = sipa.Colors.convert_to_gray(test_image)
binary = sipa.Colors.convert_to_binary(gray, 128)
blurred = sipa.Filters.mean_filter(gray, 5)
edges = sipa.Filters.detect_edge_prewitt(gray)

# Display results
plt.figure(figsize=(12, 3))
plt.subplot(1, 4, 1); plt.imshow(gray, cmap='gray'); plt.title('Grayscale')
plt.subplot(1, 4, 2); plt.imshow(binary, cmap='gray'); plt.title('Binary')
plt.subplot(1, 4, 3); plt.imshow(blurred, cmap='gray'); plt.title('Blurred')
plt.subplot(1, 4, 4); plt.imshow(edges, cmap='gray'); plt.title('Edges')
plt.show()

📸 Application Screenshots

Main Interface - Image Selection Screenshot 2024-05-27 004906

Double Threshold Operation Demonstrates advanced thresholding with three output levels Screenshot 2024-05-27 005009

Image Blurring (Mean Filter) Shows noise reduction using mean filtering technique Screenshot 2024-05-27 005059

Morphological Operations - Erosion Binary image processing for shape analysis Screenshot 2024-05-27 005406

Noise Addition Adding salt and pepper noise for filter testing Screenshot 2024-05-27 005810

Noise Removal Effective noise reduction using median filter Screenshot 2024-05-27 005825

🛠️ Technical Implementation

Core Technologies

  • Python 3.7+: Modern Python development
  • NumPy: Mathematical operations and array processing
  • PyQt5: Cross-platform GUI framework
  • Matplotlib: Histogram visualization
  • OpenCV: Basic image I/O operations

Architecture

sipa/
├── core/           # Image processing algorithms
│   ├── colors.py      # Color space conversions
│   ├── filters.py     # Filtering operations
│   ├── histogram.py   # Histogram & morphology
│   ├── rotate.py      # Geometric transformations
│   └── arithmetic.py  # Image arithmetic
├── gui/            # User interface
│   ├── main_window.py # Main application window
│   └── ui_main_window.py # Qt Designer UI file
└── main.py         # Application entry point

🎓 Educational Value

Learning Objectives

  • Algorithm Understanding: See how image processing works under the hood
  • NumPy Mastery: Advanced array manipulation techniques
  • Computer Vision Basics: Fundamental concepts in image analysis
  • GUI Development: PyQt5 application structure

Suitable For

  • Computer Science students
  • Image processing beginners
  • Python developers
  • Educators and researchers

🔧 Development

Setting up Development Environment

git clone https://github.com/haydarkadioglu/simple-image-processing-application.git
cd simple-image-processing-application
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -e ".[dev]"

Running Tests

pytest tests/
python examples/basic_usage.py

Building Distribution

python -m build

📋 Requirements

System Requirements

  • Python 3.7 or higher
  • 512 MB RAM minimum
  • 100 MB disk space
  • Windows, macOS, or Linux

Dependencies

  • numpy >= 1.19.0
  • matplotlib >= 3.3.0
  • PyQt5 >= 5.15.0
  • opencv-python >= 4.5.0

🤝 Contributing

Contributions are welcome! Please feel free to:

  • Report bugs and issues
  • Suggest new features
  • Submit pull requests
  • Improve documentation

Development Guidelines

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👨‍💻 Author

Haydar Kadıoğlu

🙏 Acknowledgments

  • Educational image processing community
  • NumPy development team
  • PyQt5 framework contributors
  • Computer vision researchers and educators

📈 Future Enhancements

  • Advanced filtering techniques (Gaussian, Laplacian)
  • More geometric transformations (affine, perspective)
  • Color space conversions (HSV, LAB)
  • Frequency domain operations (FFT)
  • Machine learning integration
  • Real-time image processing
  • Plugin architecture

This project is designed for educational purposes to help understand fundamental image processing concepts through hands-on implementation.

About

In this application the target is, write simple and easy to understand for who learns image processing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages