error in calculate coefficient
Ältere Kommentare anzeigen
img = double(imread('zoneplate.png','png'));
%img = load('ndvi2000taille100.mat');
img = imresize(img,[50,50]);
%end
[row col] = size(img);
ndir = [2 2 1 1 0];
for j = 1:5
for k = -2^(ndir(j)):2^(ndir(j))
coeff_h{j}(:,:,k+(2^(ndir(j))+1)) = obtain_shear_coeff(img,[3 3 4 4 5],ndir(j),'hor',j,k);
%Keep only the highest magnitude
ind=coeff_h{j}(:,:,k+(2^(ndir(j))+1))<0;
coeff_h{j}(:,:,ind)=0;
coeff_v{j}(:,:,k+(2^(ndir(j))+1)) = obtain_shear_coeff(img,[3 3 4 4 5],ndir(j),'ver',j,k);
end
end
% Display original image
colormap gray;
subplot(1,1,1), imagesc( img, [0 255] ) ;
title( sprintf('Original Image' )) ;
% Display shearlet coeff for horizontal cone
figure; clf;
colormap gray;
tmp1 = []; tmp2 = []; tmp3 = []; tmp4 = []; tmp5 = [];
for k = 1:9
if k < 9
tmp1 = [ tmp1; coeff_h{1}(:,:,k); 255*ones(5,col/2) ];
else
tmp1 = [ tmp1; coeff_h{1}(:,:,k)];
end
end
for k = 1:9
if k < 9
tmp2 = [ tmp2; coeff_h{2}(:,:,k); 255*ones(5,col/4) ];
else
tmp2 = [ tmp2; coeff_h{2}(:,:,k)];
end
end
for k = 1:5
if k < 5
tmp3 = [ tmp3; coeff_h{3}(:,:,k); 255*ones(5,col/8) ];
else
tmp3 = [ tmp3; coeff_h{3}(:,:,k)];
end
end
for k = 1:5
if k < 5
tmp4 = [ tmp4; coeff_h{4}(:,:,k); 255*ones(5,col/16) ];
else
tmp4 = [ tmp4; coeff_h{4}(:,:,k)];
end
end
for k = 1:3
if k < 3
tmp5 = [ tmp5; coeff_h{5}(:,:,k); 255*ones(5,col/32) ];
else
tmp5 = [ tmp5; coeff_h{5}(:,:,k)];
end
end
subplot(1,5,1), imagesc( tmp1 ) ;
subplot(1,5,2), imagesc( tmp2 ) ;
subplot(1,5,3), imagesc( tmp3 ) ;
title( sprintf('Shearlet Coefficients for horizontal cone' )) ;
subplot(1,5,4), imagesc( tmp4 ) ;
subplot(1,5,5), imagesc( tmp5 ) ;
% Display shearlet coeff for vertical cone
figure; clf;
colormap gray;
tmp1 = []; tmp2 = []; tmp3 = []; tmp4 = []; tmp5 = [];
for k = 1:9
if k < 9
tmp1 = [ tmp1 coeff_v{1}(:,:,k) 255*ones(row/2,5) ];
else
tmp1 = [ tmp1 coeff_v{1}(:,:,k)];
end
end
for k = 1:9
if k < 9
tmp2 = [ tmp2 coeff_v{2}(:,:,k) 255*ones(row/4,5) ];
else
tmp2 = [ tmp2 coeff_v{2}(:,:,k)];
end
end
for k = 1:5
if k < 5
tmp3 = [ tmp3 coeff_v{3}(:,:,k) 255*ones(row/8,5) ];
else
tmp3 = [ tmp3 coeff_v{3}(:,:,k)];
end
end
for k = 1:5
if k < 5
tmp4 = [ tmp4 coeff_v{4}(:,:,k) 255*ones(row/16,5) ];
else
tmp4 = [ tmp4 coeff_v{4}(:,:,k)];
end
end
for k = 1:3
if k < 3
tmp5 = [ tmp5 coeff_v{5}(:,:,k) 255*ones(row/32,5) ];
else
tmp5 = [ tmp5 coeff_v{5}(:,:,k)];
end
end
subplot(5,1,1), imagesc( tmp1 ) ;
title( sprintf('Shearlet Coefficients for vertical cone' )) ;
subplot(5,1,2), imagesc( tmp2 ) ;
subplot(5,1,3), imagesc( tmp3 ) ;
subplot(5,1,4), imagesc( tmp4 ) ;
subplot(5,1,5), imagesc( tmp5 ) ;
error : Out of memory. The likely cause is an infinite recursion within the program.
Error in resample1 (line 6)
y = resample1(x, type, shift, extmod);
4 Kommentare
Image Analyst
am 16 Feb. 2022
You forgot to attach 'zoneplate.png'. I'll check back later for it.
What is obtain_shear_coeff? Please attach it.
randino randino
am 16 Feb. 2022
The grand reveal —
I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/896585/zoneplate.png');
figure
imshow(I)
.
randino randino
am 16 Feb. 2022
Bearbeitet: randino randino
am 16 Feb. 2022
Antworten (1)
Voss
am 17 Feb. 2022
0 Stimmen
Like the error message says:
error : Out of memory. The likely cause is an infinite recursion within the program.
Error in resample1 (line 6)
y = resample1(x, type, shift, extmod);
The error happens in resample1(), which we cannot see here. Maybe resample1() is being called by obtain_shear_coeff(), which we also do not have access to.
You should check where resample1 is being called, check that it is being called correctly, and check that it is defined correctly.
5 Kommentare
Image Analyst
am 17 Feb. 2022
What is the name of your m-file? It's not resample.m is it? Because that would be bad.
randino randino
am 17 Feb. 2022
Image Analyst
am 17 Feb. 2022
Unrecognized function or variable 'MakeONFilter'.
Error in obtain_shear_coeff (line 77)
qmf2 = MakeONFilter('Symmlet',4);
Error in test7 (line 22)
coeff_h{j}(:,:,k+(2^(ndir(j))+1)) = obtain_shear_coeff(img,[3 3 4 4 5],ndir(j),'hor',j,k);
Voss
am 17 Feb. 2022
@randino randino: The discussion following this answer may be useful to refer to:
randino randino
am 17 Feb. 2022
Bearbeitet: randino randino
am 18 Feb. 2022
Kategorien
Mehr zu Color and Styling finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
