## Code Record

**2019-08-28**

[DOI: 10.21982/j9jg-vm40
_target: ] S2sharp

Ulfarsson, Magnus; Palsson, Frosti ; Mura, Mauro Dalla; Sveinsson, Johannes

% Usage [ Xhat_im , output ] = S2sharp(Yim,varargin)
%
% When using this code please refer to
%
% Sentinel-2 Sharpening Using a Reduced-Rank Method, M.O. Ulfarsson et al.
% IEEE Transactions on Geoscience and Remote Sensing, 2019.
%
% This method sharpens bands the 60m bands B1,B9 and the 20m bands
% B4,B5,B6,B7,B8a,B11,B12 to 10m resolution. We assume that
% the noisy satellite images yi, i=1,...,L are related to the full
% resolution target images by
%
% yi = Mi*Bi*xi + ni, i=1,...,L
%
% where Mi is a downsampling operator, Bi is a circulant blurring matrix,
% and ni is noise. The method solves
% min (1/2) sum_{i=1}^L || y_i - Mi*Bi*G*fi ||^2 + sum_{j=1}^r lam_j * phi(gj)
% F, G
% where phi is a regularizer function.
% The function returns Xhat=G*F'.
%
%
% Input:
% Yim : 1x12 cell array containing the observed images for each of
% the nb bands of the Sentinel 2 sensor.
% CDiter: Number of cyclic descent iterations.
% CDiter=10 is the default.
% r: The subspace dimension, r=7 is the default.
% lambda: The regularization parameter, lambda=0.005 is the
% default.
% Xm_im: nl x nc x nb 3D matrix containing the true (10m resolution)
% q: penalty weights, if r=7 then q= [1, 1.5, 4, 8, 15, 15, 20 ]'
% is the default otherwise the default is q=ones(p,1). Note
% that lam_i = lam*q_i
% X0: Initial value for X = G * F'
% Gstep_only: If Gstep_only=1 then perform the G-step (once). Assuming that F is fixed
% GCV: If GCV=1 then the GCV value is computed.
% Output: output is a structure containing the following fields
% Xhat_im: estimated image (3D) at high resolution (10m) for each
% spectral channel
% SAMm: mean SAM for the 60m and 20m bands (empty if Xm_im is not
% available)
% SAMm_2m: mean SAM for the 20m bands (empty if Xm_im is not available)
% SRE: signal to reconstruction error for all the 12 bands
% (empty if Xm_im is not available)
% GCVscore: Contains the GCV score if it was GCV=1 otherwise GCV is
% empty.
% ERGAS_20m: ERGAS score for the 20 m bands
% ERGAS_60m: ERGAS score for the 60 m bands
% aSSIM: average Structural Similarity Index
% RMSE: Root mean squared error
% Time: computational time
% Magnus O. Ulfarsson, September 2017.
% Acknowledgement:
%
% S2sharp uses some code from
%
% C. Lanaras, J. Bioucas-Dias, E. Baltsavias, and K. Schindler, “Superresolution
% of multispectral multiresolution images from a single sensor,”
% in IEEE Conference on Computer Vision and Pattern Recognition
% Workshops (CVPRW), 2017.
%
% https://github.com/lanha/SupReME
%
% The Manopt software
% https://www.manopt.org/
%

**Code Site: **https://github.com/mou12/S2Sharp
**Code Access Instructions: **The main code is S2sharp.m
example.m shows how to use it.

**Appears in: **The method behind the code was published in

M.O. Ulfarsson, F. Palsson, M. Dalla Mura, JR Sveinsson, Sentinel-2 Sharpening Using a Reduced-Rank Method, Transactions on Geoscience and Remote Sensing, volume 57, issue 9, 2019.**Code Languages: **Other - Matlab**To compile code: **There is no need to compile. The software was developed in MATLAB Version: 9.3.0.713579 (R2017b)**Sensor Categories: **Optical Imager, Optical Spectrometer**Geophysical Model: **Inverse **Geophysical Categories: **Land: Land Cover/Land Use**Keywords: **Multispectral, Remote Sensing, Superresolution, inverse problem, Sentinel-2