杨建超教授公布的代码,字典已经训练好,不需要重新训练。可以直接运行进行超分辨率的重建。
1、
% =========================================================================
% Simple demo codes for image super-resolution via sparse representation
%
% Reference
% J. Yang et al. Image super-resolution as sparse representation of raw
% image patches. CVPR 2008.
% J. Yang et al. Image super-resolution via sparse representation. IEEE
% Transactions on Image Processing, Vol 19, Issue 11, pp2861-2873, 2010
%
% Jianchao Yang
% ECE Department, University of Illinois at Urbana-Champaign
% For any questions, send email to jyang29@uiuc.edu
% =========================================================================
clear all; clc;
% read test image
im_l = imread('Data/Testing/input.bmp');
% set parameters
lambda = 0.2; % sparsity regularization,lambda是个常量正系数,平衡下稀疏系数alpha的重要性
overlap = 4; % the more overlap the better (patch size 5x5)重叠
up_scale = 2; % scaling factor, depending on the trained dictionary
maxIter = 20; % if 0, do not use backprojection 反投影
% load dictionary加载之前训练好的字典
load('Dictionary/D_1024_0.15_5.mat');
% change color space, work on illuminance only
% Y'为颜色的亮度(luma)成分、而CB和CR则为蓝色和红色的浓度偏移量成份
im_l_ycbcr = rgb2ycbcr(im_l);%Convert RGB color values to YCbCr color space。
im_l_y = im_l_ycbcr(:, :, 1);%取 im_l_ycbcr的第1页
im_l_cb = im_l_ycbcr(:, :, 2);%取 im_l_ycbcr的第2页
im_l_cr = i