
%--------------------------- Load Parameters ----------------------------------

%run_Bregman_1d

params = loadParameters_Breg_1d();


orim = params{1};

     [f0]=(imread(orim));
[vf hf d]=size(f0);
if d==3
     f0=rgb2gray(f0);
end


iter_c_grad =str2num(params{12});
f0=double(f0);


IND=str2num(params{2});
DeTr = str2num(params{3});

no_Breg_iter = str2num(params{4});
lamu = str2num(params{5});
lambda=lamu(1);
muu=lamu(2);

span_kern =str2num(params{7});
if params{6}=='ga';
 ker = fspecial('gaussian',[span_kern(1), 1],span_kern(2));ker=double(ker);   

end
ker=double(ker); 
[vf,hf]=size(f0);
F1=f0;

 
std_nois=str2num(params{9});
if params{10}=='y'
    nois=std_nois*randn(vf,hf);
end
for kk=1:hf
F1(:,kk)=conv(f0(:,kk),ker,'same');

end

F2=F1+nois;
F3=F2;  
FF3=F2;  
if params{11}=='y'
percent_loss=str2num(params{8});
pl=round((percent_loss/100)*vf);
 IND_noise=zeros(pl,hf);;
  for kk=1:hf
      i_I=randperm(vf);
      ipl=i_I(1:pl)';
IND_noise(:,kk)=ipl;
F3(ipl,kk)=0;
FF3(ipl,kk)=255;
  end

end

HMWF=hmwf(IND,DeTr,1,hf);
r10=fram34_dec_hmwf(zeros(1,vf),DeTr,IND,HMWF);
uk=zeros(vf,hf);
tic
for kk=1:hf
    kk
ukk  =zeros(vf,1);
bk=r10;
dk=bk;
r1=conv(F3(:,kk),ker,'same' )';

for iii=0:no_Breg_iter 
    
    
[ukk,dk,bk]=BREGMAN_INPAINT_DEBLU_hm_1d(IND_noise(:,kk),r1,dk,bk,ker,DeTr,IND,muu,lambda,iter_c_grad,HMWF);

end
uk(:,kk)=ukk';
end
toc
[ve, ho]=size(uk);


display_breg