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
-
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
-
ImageWithLowIllumination.mlx(MATLAB Live Script)- Low illumination image enhancement
- MATLAB-based image processing techniques
- Interactive visualizations
Located in the img/ directory:
noisy.png- Noisy image for testing noise cancellationnoisy.jpg- Alternative noisy imagelow_illumination.png- Low illumination image for enhancement
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
# 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# Install all required packages
pip install numpy pillow matplotlib scipy jupyterCreate 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# 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 itThe MATLAB notebook (ImageWithLowIllumination.mlx) requires the following toolboxes:
-
Image Processing Toolbox
- Core image processing functions
- Image reading, writing, and display
- Filtering and enhancement operations
- Color space conversions
-
Signal Processing Toolbox (optional but recommended)
- Advanced filtering operations
- FFT-based spectral analysis
- Signal enhancement techniques
-
Check Installed Toolboxes:
ver -
Install Missing Toolboxes:
- Open MATLAB
- Go to Home β Add-Ons β Get Add-Ons
- Search for "Image Processing Toolbox"
- Click Install
-
Verify Installation:
license('test', 'image_toolbox')
Returns
1if installed correctly.
- Open MATLAB
- Navigate to the project directory:
cd 'c:\Users\35191\Desktop\UNIR\Classes\ImageEnhancing'
- Double-click
ImageWithLowIllumination.mlxin the Current Folder browser - Run the live script using the Run button or press
Ctrl+Shift+Enter
- Adjusts pixel intensities based on the arithmetic mean
- Reduces noise by normalizing image intensity
- Applied to noisy images
- Uses geometric mean for low illumination correction
- Better preserves relative pixel relationships
- Applied to low illumination images
- Removes low-frequency components (smooth variations)
- Emphasizes edges and fine details
- Useful for sharpening images
- Removes high-frequency components (noise)
- Smooths the image
- Reduces random noise and artifacts
- Keeps only specific frequency ranges
- Combines benefits of high-pass and low-pass filters
- Targets specific types of noise or features
- Original: Contains significant random noise
- After Arithmetic Mean Correction: Reduced noise, normalized intensity
- After Spectral Filtering: Cleaner image with preserved details
- Original: Dark image with poor visibility
- After Geometric Mean Correction: Enhanced brightness
- After Spectral Filtering: Improved contrast and detail visibility
# 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% 1. Check toolboxes
ver
% 2. Open the live script
open('ImageWithLowIllumination.mlx')
% 3. Run all sections
% Click Run button or press Ctrl+Shift+Enter- Fourier Transform and frequency domain filtering
- Spatial domain enhancement techniques
- Noise reduction algorithms
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
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
- 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
For questions or issues related to this project, please contact:
RaΓΊl Homero Llasag Rosero
This project is part of academic coursework for UNIR.
Happy Image Processing! πΌοΈβ¨