A comprehensive image processing toolkit developed with MATLAB GUIDE, integrating classical algorithms with real-time visualization capabilities. Features modular architecture and a complete workflow from basic geometric transformations to advanced image analysis. Suitable for digital image processing education, algorithm verification, and rapid prototyping.
- Dual-view comparison: Original image and processed result displayed side by side
- Pixel waveform analysis: Real-time display of RGB/grayscale pixel waveforms for the first row
- Histogram statistics: Dynamic updates of image grayscale/color distribution
- Intelligent type detection: Automatic recognition of color/grayscale images with corresponding visualization mode switching
- MATLAB GUIDE-based graphical user interface
- Event-driven callback function architecture
handlesstruct for state management- Modular function design (
gUpdate22/gUpdate23) - Supported formats: JPG, PNG, BMP, JPEG
| Function | Implementation | Parameter Control |
|---|---|---|
| Horizontal/Vertical Mirroring | fliplr() / flipud() |
Button trigger |
| Image Translation | imtranslate() with cumulative offset |
Dual sliders for real-time control |
| Image Rotation | imrotate() with bilinear interpolation |
Slider 0-360 degrees |
| Image Scaling | imresize() with nearest-neighbor + imcrop() |
Slider ratio control |
Technical Details:
- Translation uses incremental vector
V = [delta_h, delta_v]for cumulative transformations - Rotation and scaling operate on the original image to avoid cumulative error
- Scaling automatically crops to the original size for display consistency
% Mean filter - 3x3 average kernel
h = fspecial('average');
% Gaussian filter - 8x8 window, sigma=1.7
h = fspecial('gaussian', [8 8], 1.7);
% Median filter - per-channel processing for RGB
r = medfilt2(img(:,:,1));
g = medfilt2(img(:,:,2));
b = medfilt2(img(:,:,3));Application Scenarios:
- Mean filtering: Fast denoising, suitable for Gaussian noise
- Median filtering: Edge-preserving denoising, suitable for salt-and-pepper noise
- Gaussian filtering: Image smoothing, preserves more detail
Five classical edge detection operators are implemented:
| Operator | Principle | Characteristics |
|---|---|---|
| Sobel | 3x3 gradient operator | Good noise resistance, suitable for real-time processing |
| Roberts | 2x2 cross difference | Simple computation, precise localization |
| Prewitt | 3x3 smoothed gradient | Good smoothing effect |
| LoG | Laplacian of Gaussian | Second derivative, sensitive to noise |
| Canny | Multi-stage optimization | Highest precision, industry standard |
Implementation Details:
- Color images are automatically converted to grayscale (
rgb2gray) - Uses MATLAB's built-in optimized
edge()function - Edge detection results are binary images
% Brightness enhancement - expands dark details
imadjust(img, [0, 0.9], [0, 1]);
% Brightness reduction - expands bright details
imadjust(img, [0.1, 1], [0, 1]);- Global contrast-adaptive enhancement based on
histeq() - Automatic redistribution of gray levels to improve image visibility
- Suitable for low-contrast and underexposed images
alpha = 0.5;
result = imadd(alpha * img1, alpha * img2);- Weight coefficient alpha = 0.5 for equal-weight blending
- Automatic size matching (
imresize)
result = imfuse(img1, img2, 'blend');- Uses MATLAB's
imfuseadvanced fusion algorithm - Supports multiple fusion modes
Threshold Segmentation - Binarization based on global threshold
binary = rgb2gray(img) > threshold;- Real-time threshold adjustment via slider (0-255)
- Automatic conversion to grayscale before segmentation
- Suitable for scenarios with simple background and high contrast
+--------------------------------------------------------+
| [Open] [Save] [Reset] [Exit] |
+------------------+--------------------------------------+
| | Control Panel |
| Original | +- Geometric Transform |
| Image | +- Filtering |
| (g11) | +- Edge Detection |
| | +- Enhancement |
+------------------+ +- Segmentation |
| Processed | |
| Image | Sliders: |
| (g12) | - H/V Translation |
| | - Rotation (0-360 degrees) |
+------------------+ - Resize (0.1-2.0x) |
| Waveform | - Threshold (0-255) |
| (g21, g22) | |
+------------------+ |
| Histogram | |
| (g23) | |
+------------------+--------------------------------------+
handles.img % Current processed image
handles.i % Original image backup
handles.h % Cumulative horizontal translation
handles.v % Cumulative vertical translation
handles.file % File pathUser Operation -> Callback Function -> Image Processing -> Update Display
+-- Update g12 (processed image)
+-- Detect image type
+-- Call gUpdate22/23
| +-- Update waveform (g22)
| +-- Update histogram (g23)
+-- Save state (guidata)
| Operation | Time Complexity | Space Complexity | Notes |
|---|---|---|---|
| Geometric Transformations | O(n) | O(n) | n = total pixels |
| Mean/Gaussian Filtering | O(n x k^2) | O(k^2) | k = kernel size |
| Median Filtering | O(n x k^2 x log k) | O(k^2) | Sorting overhead |
| Edge Detection | O(n) | O(n) | Optimized implementation |
| Histogram Equalization | O(n + L) | O(L) | L = number of gray levels |
| Threshold Segmentation | O(n) | O(n) | Fastest segmentation method |
- MATLAB: R2018b or higher
- Toolbox: Image Processing Toolbox
- Operating System: Windows / macOS / Linux
- Memory: 4GB RAM or more
- Processor: Intel i5 or equivalent
- Display: 1920x1080 or higher resolution
- Clone the repository
git clone https://github.com/OlyMarco/MATLAB_Image_Processing.git
cd MATLAB_Image_Processing-
Launch MATLAB
- Open MATLAB
- Navigate to the project directory
-
Run the program
cd Image_Processing
Image_Processing- Load image: Click the
Openbutton to select an image file - Apply processing: Choose the desired image processing function
- Adjust parameters: Use sliders to adjust parameters in real time
- View results: Compare original and processed images, view waveforms and histograms
- Save image: Click the
Savebutton to export the processed result - Reset: Click the
Resetbutton to restore the original image
MATLAB_Image_Processing/
├── LICENSE # MIT open source license
├── README.md # Project documentation
├── Image_Processing/
│ ├── Image_Processing.m # Main program (869 lines)
│ │ ├── GUI initialization
│ │ ├── Callback functions (30+)
│ │ ├── Visualization update functions
│ │ └── Utility functions
│ └── Image_Processing.fig # GUIDE interface design file
└── images/
└── main.png # Application screenshot
- MVC Architecture: View (fig) + Controller (callbacks) + Model (handles)
- Event-driven: Based on MATLAB's callback mechanism
- State pattern: UI state management using Enable/Visible properties
- Modular: Independent callback functions for each feature
- Reusable: Encapsulated visualization update functions
- Robust: Type detection and error warnings
- Maintainable: Clear code structure and comments
- Progressive enablement: Processing features disabled until an image is loaded
- Immediate feedback: All operations update the display in real time
- Progress indication: Progress bar displayed when loading images
- Friendly prompts: Warning dialogs for invalid operations
- Batch processing mode
- Undo/Redo stack
- Additional segmentation algorithms (Otsu, K-means, Watershed)
- Morphological operations (erosion, dilation, opening, closing)
- Frequency domain filtering (FFT, spectrum analysis)
- Custom convolution kernel editor
- Image quality assessment metrics (PSNR, SSIM)
- Export processing workflow as script
- Multi-threaded acceleration for large image processing
- More refined parameter adjustment (input box + slider)
- Support for additional image formats (TIFF, RAW)
- Operation history panel
- Gonzalez, R. C., & Woods, R. E. (2018). Digital Image Processing (4th ed.)
- MATLAB Image Processing Toolbox Documentation
- Canny, J. (1986). "A Computational Approach to Edge Detection"
Sincere thanks to all researchers and engineers who have contributed to the field of digital image processing.
