1、
clear all; clc; close all;
addpath(genpath('RegularizedSC'));
TR_IMG_PATH = 'Data/Training';
dict_size = 512; % dictionary size
lambda = 0.15; % sparsity regularization????????怎么用
patch_size = 5; % image patch size
nSmp = 100000; % number of patches to sample
upscale = 2; % upscaling factor上采样
% randomly sample image patches
[Xh, Xl] = rnd_smp_patch(TR_IMG_PATH, '*.bmp', patch_size, nSmp, upscale);
% prune减少 patches with small variances,临界值 threshould chosen based on the
% training data
[Xh, Xl] = patch_pruning(Xh, Xl, 10);
% joint sparse coding
[Dh, Dl] = train_coupled_dict(Xh, Xl, dict_size, lambda, upscale);
dict_path = ['Dictionary/D