Out of memory. The likely cause is an infinite recursion within the program. Error in resample1 (line 6) y = resample1(x, type, shift, extmod);

2 views (last 30 days)
%
img = double(imread('barbara.jpg','jpg'));
%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 ) ;
  8 Comments

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 24 Oct 2021
I'm not familiar with this third-party Contourlet Toolbox (you may need to talk to the author of that toolbox for help) but this comment in resample1.m (which is NOT going to work as written) makes me wonder if resample1.m was a "backup" for a MEX-file and was never intended to be executed.
% See source code resample1.c
Did the installation instructions for this toolbox instruct you to run a command to build MEX-files?
  40 Comments

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!