A comprehensive, modular, end-to-end computer vision and intelligent image processing framework implemented in Python with an interactive web-based user interface. This system encompasses the complete digital image processing pipeline: raw image acquisition, standardized preprocessing, synthetic noise modeling, image restoration, adaptive contrast enhancement, morphological segmentation, object feature extraction, quantitative evaluation metrics (MSE, PSNR, SSIM), and web dashboard visualization.
- Problem Statement
- Real-World Use Cases
- Tech Stack and Version Requirements
- Web Application and Frontend Interface
- System Architecture and Workflow
- Detailed Task Breakdown
- Quantitative Performance Evaluation
- Directory Structure
- Quick Start and Installation
- Usage Instructions
- Future Scope and Enhancements
- Author and Academic Details
- License
In practical computer vision and digital image processing applications, optical sensors and image capture hardware frequently introduce degradation due to atmospheric distortion, inadequate illumination, sensor thermal noise, and electronic interference. Raw visual data cannot be reliably processed by downstream analytical or machine learning algorithms without prior systematic enhancement and restoration.
- Noise Degradation: Mitigation of additive Gaussian thermal noise and impulsive Salt-and-Pepper transmission noise.
- Illumination Variations: Rectification of non-uniform lighting conditions that impair global edge detection and static thresholding algorithms.
- Segmentation Accuracy: Separation of foreground target objects from complex backgrounds using automatic and adaptive spatial thresholding combined with morphological operators.
- Feature Representation: Extraction of scale- and rotation-invariant keypoints (ORB), structural contours, and edge boundaries for object recognition.
- Objective Quality Assessment: Computation of mathematical and perceptual evaluation metrics (MSE, PSNR, SSIM) to quantitatively validate image restoration performance.
This project delivers an automated, 7-stage processing pipeline to address these challenges with reproducible statistical verification.
| Domain / Industry | Application Scenario | Primary Technique / Module |
|---|---|---|
| Medical Diagnostics | Denoising MRI, CT, and X-ray images; segmenting tissue structures and lesion boundaries | CLAHE, Median Filter, Otsu Thresholding |
| Industrial Inspection | Detecting micro-cracks, surface defects, and automated component verification on assembly lines | Morphological Gradient, Canny Edges, Contour Analysis |
| Autonomous Systems | Road sign classification, lane detection, and feature point tracking under low visibility | ORB Descriptors, Adaptive Gaussian Thresholding |
| Document Processing & OCR | Restoring faded historical texts, removing background paper artifacts, and binarizing low-contrast scans | Adaptive Thresholding, CLAHE |
| Microscopy & Research | Quantitative cell counting, structural area measurement, and image degradation benchmarking | Bounding Boxes, SSIM / PSNR Metrics |
- Python: Version
3.7+(Tested and recommended:Python 3.8through3.11)
- Web Framework: Flask (
v2.0+) - UI Architecture: HTML5, CSS3, JavaScript, Jinja2 Template Engine (
templates/)
| Library / Package | Minimum Required Version | Functional Purpose |
|---|---|---|
opencv-python |
>= 4.5.0 |
Digital image matrix transformations, color space conversions, spatial filtering, morphological operations, ORB feature extraction |
flask |
>= 2.0.0 |
Light-weight Web server and routes for web dashboard rendering (app.py) |
numpy |
>= 1.21.0 |
Multi-dimensional array operations, matrix mathematics, synthetic noise generation routines |
matplotlib |
>= 3.4.0 |
Rendering multi-panel pipeline comparison plots, intensity histograms, and saved visual outputs |
scipy |
>= 1.7.0 |
Advanced scientific computing functions and spatial signal filtering kernels |
scikit-image |
>= 0.18.0 |
Structural Similarity Index Measure (SSIM) and perceptual image quality algorithms |
scikit-learn |
>= 0.24.0 |
Data analytics tools and evaluation metric calculations |
Pillow (PIL) |
>= 8.3.0 |
Image file input/output validation and file format support |
The system features an interactive, browser-based web dashboard (app.py) built with Flask and responsive HTML5/CSS3 templates (templates/). This interface enables users to interact with the underlying computer vision algorithms without command-line invocation.
- Interactive Image Upload: Drag-and-drop or upload custom image files (JPEG, PNG, WebP, BMP, TIFF).
- Real-Time Visual Stage Comparisons: Side-by-side display comparing Original, Degraded, Denoised, Enhanced, Segmented, and Feature-Extracted visual outputs.
-
Dynamic Parameter Control: Tune filter kernel sizes, thresholding values, noise variance (
$\sigma$ ), and CLAHE parameters through the UI. - Live Metric Reporting: Real-time computation and display of MSE, PSNR, and SSIM values directly on the web page.
python app.pyNavigate to http://localhost:5000 or http://127.0.0.1:5000 in your web browser.
┌────────────────────────────────────────────────────────────────────────┐
│ Interactive Web UI (Flask / HTML5 Templates) │
│ http://localhost:5000 (app.py) │
└──────────────────────────────────┬─────────────────────────────────────┘
│ Uploads / Triggers Pipeline
▼
┌─────────────────┐ ┌───────────────────┐ ┌────────────────────┐
│ Raw Image │ ──> │ Task 2: Load & │ ──> │ Task 3: Noise & │
│ Acquisition │ │ Preprocess │ │ Restoration/CLAHE │
└─────────────────┘ └───────────────────┘ └────────────────────┘
│
┌─────────────────┐ ┌───────────────────┐ ▼
│ Task 7: Full │ <── │ Task 6: Metric │ <── ┌────────────────────┐
│ Pipeline View │ │ Evaluation │ │ Task 4: Segment & │
└─────────────────┘ └───────────────────┘ │ Morphological Ops │
▲ └────────────────────┘
│ │
└───────────────────────────┘
Task 5: Features & ORB
- Standardized directory layout for raw inputs, modular functional code, and output artifacts.
- Environment verification and logging module for execution tracking.
- Supported Formats: JPEG, PNG, WebP, BMP, TIFF.
-
Dimensional Standardization: Resizing arbitrary inputs to a uniform
$512 \times 512$ resolution matrix. - Color Space Transformation: Converting multi-channel RGB images to single-channel Grayscale matrices.
-
Synthetic Degradation Modeling:
- Gaussian Noise: Simulation of thermal sensor noise ($\mathcal{N}(\mu=0, \sigma=25)$).
-
Salt-and-Pepper Noise: Impulse transmission noise (
$p = 0.05$ ).
-
Spatial Denoising Filters:
-
Mean Filter:
$5 \times 5$ linear spatial smoothing kernel. -
Median Filter:
$5 \times 5$ non-linear rank-order filter for impulsive noise elimination. -
Gaussian Filter: Isotropic spatial smoothing kernel (
$\sigma=1.5$ ).
-
Mean Filter:
-
Contrast Optimization:
- Global Histogram Equalization: Uniform redistribution of pixel intensity histograms.
-
CLAHE: Contrast Limited Adaptive Histogram Equalization (
$\text{tile_size}=8 \times 8, \text{clip_limit}=3.0$ ).
-
Binarization Methods:
-
Global Thresholding: Static intensity cutoff (
$T = 127$ ). - Otsu's Thresholding: Automated bimodal threshold selection via inter-class variance maximization.
- Adaptive Thresholding: Localized Gaussian-weighted neighborhood thresholding.
-
Global Thresholding: Static intensity cutoff (
-
Morphological Processing:
- Dilation and Erosion: Expansion and contraction of foreground structural elements.
- Opening: Sequential erosion and dilation for isolated background noise removal.
- Closing: Sequential dilation and erosion for hole filling and boundary bridging.
- Morphological Gradient: Difference between dilated and eroded images to isolate structural boundaries.
-
Edge Extraction:
-
Sobel Operator: First-order spatial gradient computation (
$G_x, G_y$ ). - Canny Detector: Multi-stage edge detection featuring non-maximum suppression and hysteresis thresholding.
-
Sobel Operator: First-order spatial gradient computation (
-
Contour Analysis:
- Identification of structural contours (3,174 identified) and bounding box generation around discrete objects.
-
Keypoint Detection:
- ORB (Oriented FAST and Rotated BRIEF): Extraction of 498 scale- and rotation-invariant feature descriptors.
Quantitative verification comparing degraded and restored images across three objective standards:
- MSE (Mean Squared Error): Arithmetic average of squared intensity differences.
- PSNR (Peak Signal-to-Noise Ratio): Logarithmic signal-to-noise power ratio measured in decibels (dB).
-
SSIM (Structural Similarity Index Measure): Perceptual structural preservation metric (
$0.0$ to$1.0$ ).
- Generation of a multi-panel visual comparison illustrating the sequential transformation:
Original Input➔Degraded Image➔Denoised Image➔Contrast Enhanced➔Segmented Mask➔Feature Extraction.
Performance benchmarks recorded during empirical test execution:
| Evaluation Metric | Degraded Image | Restored Image (Median Filter) | Net Performance Variation |
|---|---|---|---|
| Mean Squared Error (MSE) ↓ | 1567.67 |
53.86 |
96.56% Error Reduction |
| Peak Signal-to-Noise Ratio (PSNR) ↑ | 16.18 dB |
30.82 dB |
+14.64 dB Signal Improvement |
| Structural Similarity (SSIM) ↑ | 0.088 |
0.732 |
+0.644 Structural Retention |
Assignment-5-Intelligent-Image-Processing/
├── main.py # CLI execution entry point (Runs command line pipeline)
├── app.py # Web application server (Flask web interface)
├── task1_setup.py # System verification module
├── task2_preprocessing.py # Image acquisition and normalization
├── task3_enhancement.py # Denoising filters and CLAHE implementation
├── task4_segmentation.py # Thresholding and morphological operators
├── task5_features.py # Edge detection, contours, and ORB descriptors
├── task6_evaluation.py # Quantitative metric calculations (MSE, PSNR, SSIM)
├── task7_visualization.py # Consolidated multi-panel visualization generator
├── utils.py # Shared utility functions
├── requirements.txt # Dependency manifest
├── LICENSE # MIT License specification
├── README.md # System documentation
├── templates/ # Frontend HTML5/CSS3 templates for web UI
│ └── index.html # Web dashboard user interface
└── outputs/ # Generated output artifacts
├── task2_preprocessing.png
├── task3_enhancement.png
├── task4_segmentation.png
├── task5_features.png
└── task7_pipeline_visualization.png
Verify that Python 3.7 or a newer version is installed on the system:
python --versiongit clone https://github.com/itsashish1/Assignment-5-Intelligent-Image-Processing.git
cd Assignment-5-Intelligent-Image-Processing- Linux / macOS:
python3 -m venv venv source venv/bin/activate - Windows (Command Prompt / PowerShell):
python -m venv venv venv\Scripts\activate
pip install -r requirements.txtTo launch the browser-based Web Interface:
python app.pyOpen your web browser and navigate to http://localhost:5000. You can upload custom images and view real-time processing results interactively.
To run all 7 tasks sequentially in batch mode and save visual outputs to disk:
python main.pyOutput visualizations will be stored directly inside the outputs/ directory.
Individual modules can be imported directly into custom Python scripts:
import task2_preprocessing as task2
import task3_enhancement as task3
# Load image and convert to standardized 512x512 grayscale matrix
original_img, grayscale_img = task2.process_image("path/to/image.jpg")
# Apply noise simulation, median filter restoration, and CLAHE enhancement
noisy_img, restored_img, enhanced_img = task3.enhance_and_restore(grayscale_img)-
Hardware Acceleration: Integration of CUDA and
CuPybindings for real-time video stream processing ($>60 \text{ FPS}$ ). - Deep Learning Architectures: Incorporation of Convolutional Neural Networks (DnCNN) for deep denoising and UNet models for semantic segmentation.
- Microservice Infrastructure: Containerization via Docker and deployment as a RESTful API service using FastAPI.
- Frontend Dashboard Enhancements: Expanding the web UI with React.js / Vue.js for enhanced canvas image manipulation and real-time histogram plotting.
- Author: Ashish Yadav
- Roll Number: 2301010413
- Degree Program: B.Tech Computer Science & Engineering (CSE)
- Institution: K.R. Mangalam University
- Course Assignment: Assignment 5 - Intelligent Image Processing System
- Repository URL: itsashish1/Assignment-5-Intelligent-Image-Processing
This project is released under the MIT License. Refer to the LICENSE file for complete details.