This repository provides a MATLAB implementation of single-image super-resolution inspired by the paper:
Qing Yan, Yi Xu, Xiaokang Yang, and Truong Q. Nguyen,
"Single Image Superresolution Based on Gradient Profile Sharpness,"
IEEE Transactions on Image Processing, vol. 24, no. 10, pp. 3187–3202, 2015.
DOI: https://doi.org/10.1109/TIP.2015.2414877
The method aims to reconstruct a high-resolution image from a low-resolution input by using Gradient Profile Sharpness (GPS) as an edge-aware image prior. Instead of relying only on interpolation, the method enhances image edges by modelling and transforming gradient profiles before reconstructing the final high-resolution image.
Single-image super-resolution is an ill-posed image processing problem because many possible high-resolution images can correspond to the same low-resolution image after downsampling.
This project follows the idea that edge sharpness can provide useful prior information for reconstructing a visually sharper high-resolution image. The original paper defines Gradient Profile Sharpness (GPS) as an edge sharpness metric based on:
- edge contrast, represented by gradient magnitude;
- edge spatial spread, represented by the scattering of the gradient profile.
The GPS value is defined as:
where:
ηis the Gradient Profile Sharpness value;his the height of the gradient profile;dis the spatial scattering of the gradient profile.
A larger GPS value indicates a sharper edge.
The algorithm consists of four main stages.
For each detected edge pixel, a one-dimensional gradient profile is extracted along the gradient direction.
A sharp edge usually has a narrow profile with high gradient magnitude, while a blurred edge has a wider profile with lower gradient concentration.
Two models are used to describe different types of gradient profiles.
The triangle model is used for short gradient profiles. These profiles usually appear around sharp edges or edges with small intensity changes.
This model can represent both symmetric and asymmetric short profiles.
The mixed Gaussian model is used for longer, heavy-tailed gradient profiles. These profiles usually appear around smooth or blurred edges.
Compared with a simple symmetric Gaussian model, the mixed Gaussian model is more flexible and can describe more complicated edge structures.
The method estimates how GPS values change between different image resolutions.
The original paper models the relationship between the GPS value in the upsampled low-resolution image and the target high-resolution image as:
where:
η_His the expected GPS value in the high-resolution image;η_Uis the GPS value in the upsampled low-resolution image;αis the transformation parameter controlling sharpness enhancement.
This relationship is used to transform gradient profiles and estimate the target high-resolution gradient field.
After transforming the gradient profiles, the algorithm reconstructs the final high-resolution image by combining:
-
Image-domain consistency
The reconstructed high-resolution image should produce the original low-resolution image when blurred and downsampled. -
Gradient-domain consistency
The gradients of the reconstructed image should be close to the transformed target gradients.
The reconstruction objective can be written as:
where:
I_His the reconstructed high-resolution image;I_Lis the low-resolution image;∇Î_His the estimated target gradient field;βcontrols the balance between image consistency and gradient consistency.
.
├── main.m # Main demo script
├── GPS_x.m # GPS processing in the x-direction
├── GPS_y.m # GPS processing in the y-direction
├── buildprofile.m # Builds gradient profiles
├── estimateGPS.m # Estimates GPS values
├── estimateAlpha.m # Estimates the GPS transformation parameter
├── transformGPS.m # Transforms gradient profiles using GPS
├── gradientprofile_x.m # Extracts horizontal gradient profiles
├── gradientprofile_y.m # Extracts vertical gradient profiles
├── modify1.m # Gradient reconstruction helper
├── modify2.m # Gradient reconstruction helper
├── MeanSquareError.m # Computes mean square error
├── rmse.m # Computes root mean square error
└── README.md
This project requires MATLAB.
Recommended MATLAB toolboxes:
- Image Processing Toolbox
- Optimisation Toolbox
- Signal Processing Toolbox
The Optimisation Toolbox may be required for fitting the mixed Gaussian model.
Clone the repository:
git clone https://github.com/Hesam-lab/Image-Super-resolution.git
cd Image-Super-resolutionOpen MATLAB and run:
mainThe script will:
- read the input image;
- generate a low-resolution version;
- upsample the low-resolution image;
- estimate GPS-based transformed gradients;
- reconstruct the high-resolution image;
- compare the proposed method with interpolation.
% Read high-resolution image
HR = imread('angioectasia-P0-2.png');
% Set upscaling factor
factor = 4;
% Generate low-resolution image
LR = imresize(HR, 1/factor);
% Upsample the low-resolution image
UR = imresize(LR, factor);
% Estimate GPS-based gradient fields
grad_x = GPS_x(UR, LR, m0, N, band);
grad_y = GPS_y(UR, LR, m0, N, band);
% Reconstruct high-resolution image
% using image-domain and gradient-domain constraintsThe output can be evaluated using:
ssim_value = ssim(reconstructed_image, original_image);
mse_value = MeanSquareError(reconstructed_image, original_image);
rmse_value = rmse(reconstructed_image, original_image);Higher SSIM and lower MSE/RMSE indicate better reconstruction quality.
The provided sample image works with the current implementation. However, some custom input images, especially non-square images, may cause dimension mismatch errors during gradient reconstruction because parts of the MATLAB code use transpose and rotation operations.
If you encounter an error with your own image, try cropping or resizing it to a square RGB image before running main.m.
@article{yan2015single,
title={Single Image Superresolution Based on Gradient Profile Sharpness},
author={Yan, Qing and Xu, Yi and Yang, Xiaokang and Nguyen, Truong Q.},
journal={IEEE Transactions on Image Processing},
volume={24},
number={10},
pages={3187--3202},
year={2015},
publisher={IEEE},
doi={10.1109/TIP.2015.2414877}
}This repository is an educational MATLAB implementation inspired by the GPS-based super-resolution method. It is not the official implementation released by the original authors.