function nmdos(img);


imagesc(img);
colormap(gray(256));
img=double(img);
[y_img x_img]=size(img);
if y_img~=x_img
    fprintf('razlicite dimenzije ulazne slike');
end
%unaprijed odredjena vrijednost praga za slucaj hard thresholdinga
P=10;



[qmf,dqmf]=MakeBSFilter('Deslauriers',3);
% par filtara koji koristimo je interpolirajuci Deslauriers-Dubuc filtar treceg 
% stupnja
wc=FWT2_PB(img, 1, qmf, dqmf);
%ovime smo dobili koeficijente wavelet transf

switch input('1 - hard thresholding\n2 - kombinacija hard i quantile\n3 - quantile\n');
    case 1
        prag=P;
    case 2
        P=input('relativni omjer\n');
        prag=(norm(img)/(norm(size(lena256))))*1/P;
    case 3
        wcs=reshape(wc,1,y_img^2);
        s=sort(abs(wcs));
        P=input('omjer kompresije\n');
        prag=s(round((1-1/P)*length(wcs)));
end
        
brojac=0;
for i=1:x_img 
  for j=1:x_img
    if ( abs(wc(i,j)) <prag) 
         wc(i,j)=0;
         brojac=brojac + 1;
    end
  end
end

x=IWT2_PB(wc, 1, qmf, dqmf);
figure
imagesc(x);
colormap(gray)
title(['omjer kompresije ', num2str( (y_img^2-brojac)/y_img^2)]);
