Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Image Enhancement Techniques

🎯 Purpose

This repository serves as a comprehensive educational resource for learning and applying image enhancement and noise reduction techniques in digital image processing. It provides hands-on implementations in both Python and MATLAB, demonstrating how to handle common image quality issues such as noise contamination and poor illumination. The notebooks showcase practical applications of frequency domain analysis (FFT-based spectral filtering) and spatial domain corrections (arithmetic and geometric mean adjustments) to improve image quality for analysis and visualization.

This project is designed for students, researchers, and practitioners interested in understanding fundamental and advanced image processing algorithms through executable code examples and visual comparisons.

Author:

  • RaΓΊl Llasag Rosero

πŸ“ Repository Contents

Notebooks

  1. NoiseCancelation.ipynb (Python)

    • Arithmetic and geometric mean correction
    • Spectral filtering using FFT (Fast Fourier Transform)
    • High-pass, low-pass, and band-pass filters
    • Noise reduction techniques
  2. ImageWithLowIllumination.mlx (MATLAB Live Script)

    • Low illumination image enhancement
    • MATLAB-based image processing techniques
    • Interactive visualizations

Sample Images

Located in the img/ directory:

  • noisy.png - Noisy image for testing noise cancellation
  • noisy.jpg - Alternative noisy image
  • low_illumination.png - Low illumination image for enhancement

🐍 Python Setup

Requirements

The Python notebook (NoiseCancelation.ipynb) requires the following packages:

  • numpy - Array manipulation and numerical operations
  • Pillow (PIL) - Image reading and basic processing
  • matplotlib - Image visualization and plotting
  • scipy - Scientific computing (geometric mean, advanced filters)
  • jupyter - Jupyter notebook environment

Installation Options

Option 1: Using Conda (Recommended)

# Create a new conda environment
conda create -n image_processing python=3.9

# Activate the environment
conda activate image_processing

# Install required packages
conda install numpy pillow matplotlib scipy jupyter

Option 2: Using pip

# Install all required packages
pip install numpy pillow matplotlib scipy jupyter

Option 3: Using requirements.txt

Create a requirements.txt file:

numpy>=1.21.0
Pillow>=9.0.0
matplotlib>=3.5.0
scipy>=1.7.0
jupyter>=1.0.0

Then install:

pip install -r requirements.txt

Running the Python Notebook

# Activate your environment (if using conda)
conda activate image_processing

# Launch Jupyter Notebook
jupyter notebook

# Or use Jupyter Lab
jupyter lab

# Navigate to NoiseCancelation.ipynb and open it

πŸ”¬ MATLAB Setup

Requirements

The MATLAB notebook (ImageWithLowIllumination.mlx) requires the following toolboxes:

Required MATLAB Toolboxes

  1. Image Processing Toolbox

    • Core image processing functions
    • Image reading, writing, and display
    • Filtering and enhancement operations
    • Color space conversions
  2. Signal Processing Toolbox (optional but recommended)

    • Advanced filtering operations
    • FFT-based spectral analysis
    • Signal enhancement techniques

Installation

  1. Check Installed Toolboxes:

    ver
  2. Install Missing Toolboxes:

    • Open MATLAB
    • Go to Home β†’ Add-Ons β†’ Get Add-Ons
    • Search for "Image Processing Toolbox"
    • Click Install
  3. Verify Installation:

    license('test', 'image_toolbox')

    Returns 1 if installed correctly.

Running the MATLAB Notebook

  1. Open MATLAB
  2. Navigate to the project directory:
    cd 'c:\Users\35191\Desktop\UNIR\Classes\ImageEnhancing'
  3. Double-click ImageWithLowIllumination.mlx in the Current Folder browser
  4. Run the live script using the Run button or press Ctrl+Shift+Enter

πŸ” Techniques Demonstrated

1. Arithmetic Mean Correction

  • Adjusts pixel intensities based on the arithmetic mean
  • Reduces noise by normalizing image intensity
  • Applied to noisy images

2. Geometric Mean Correction

  • Uses geometric mean for low illumination correction
  • Better preserves relative pixel relationships
  • Applied to low illumination images

3. Spectral Filtering (FFT-based)

High-Pass Filter

  • Removes low-frequency components (smooth variations)
  • Emphasizes edges and fine details
  • Useful for sharpening images

Low-Pass Filter

  • Removes high-frequency components (noise)
  • Smooths the image
  • Reduces random noise and artifacts

Band-Pass Filter

  • Keeps only specific frequency ranges
  • Combines benefits of high-pass and low-pass filters
  • Targets specific types of noise or features

πŸ“Š Expected Results

Noisy Image Processing

  • Original: Contains significant random noise
  • After Arithmetic Mean Correction: Reduced noise, normalized intensity
  • After Spectral Filtering: Cleaner image with preserved details

Low Illumination Image Processing

  • Original: Dark image with poor visibility
  • After Geometric Mean Correction: Enhanced brightness
  • After Spectral Filtering: Improved contrast and detail visibility

πŸš€ Quick Start Guide

For Python Users:

# 1. Set up environment
conda create -n image_processing python=3.9 -y
conda activate image_processing
conda install numpy pillow matplotlib scipy jupyter -y

# 2. Launch Jupyter
jupyter notebook

# 3. Open and run NoiseCancelation.ipynb

For MATLAB Users:

% 1. Check toolboxes
ver

% 2. Open the live script
open('ImageWithLowIllumination.mlx')

% 3. Run all sections
% Click Run button or press Ctrl+Shift+Enter

πŸ“š Additional Resources

Python Libraries Documentation

MATLAB Documentation

Image Processing Theory

  • Fourier Transform and frequency domain filtering
  • Spatial domain enhancement techniques
  • Noise reduction algorithms

πŸ› οΈ Troubleshooting

Python Issues

Problem: ModuleNotFoundError: No module named 'PIL'
Solution: Install Pillow: pip install Pillow

Problem: Images not displaying in Jupyter
Solution: Add %matplotlib inline at the beginning of your notebook

Problem: FileNotFoundError when loading images
Solution: Ensure you're running the notebook from the correct directory containing the img/ folder

MATLAB Issues

Problem: "Undefined function or variable"
Solution: Verify Image Processing Toolbox is installed using ver

Problem: Cannot open .mlx file
Solution: Update MATLAB to R2016a or later (Live Scripts introduced in R2016a)

Problem: Out of memory errors
Solution: Process images in smaller chunks or reduce image resolution


πŸ“ Notes

  • All image paths are relative to the notebook directory
  • Ensure the img/ directory is in the same folder as the notebooks
  • Python notebook uses RGB and grayscale processing
  • MATLAB Live Script provides interactive visualizations
  • Both notebooks can be modified to process your own images

πŸ“§ Contact

For questions or issues related to this project, please contact:
RaΓΊl Homero Llasag Rosero


πŸ“„ License

This project is part of academic coursework for UNIR.


Happy Image Processing! πŸ–ΌοΈβœ¨

About

This repository serves as a comprehensive educational resource for learning and applying image enhancement and noise reduction techniques in digital image processing.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages