Error : Maximum recursion limit of 5000 has been reached. HELP!!!

2 views (last 30 days)
Hello everyone,
I am running this function in my image analysis code. whenever it comes to this 'ploopgen512' function, i get the recursion error. its basically a function to generate a test image. any ideas how to fix it? this is how I'm using the function in my code:
%% load test image 'ploop'
im = ploopgen512;
%[im2, map] = imread('CT_Image.TIF');
%im = rgb2hsv(im2);
im = imnoise(im,'gaussian',0,1e-3);
% gimage(im,-1); %display image
figtitle('Original test image')
here is the ploopgen512 function code:
N = 512;
r = radius(wa([N,N],0));
r = getdata(r);
f = 0.5*ones(N,N);
g = sin(112*pi/log(2)*( 2.^(-r./56) - 2^(-256/56)));
tmp = 0.5*(1 + g.*cos(r*pi/16 - 4*pi).^2);
k = find(r < 64 & r >= 56);
f(k) = tmp(k);
tmp = 0.5*(1 + g);
k = find(r < 224 & r >= 64);
f(k) = tmp(k);
tmp = 0.5*(1 + g.*sin(r*pi/64 - 4*pi).^2);
k = find(r < 256 & r >= 224);
f(k) = tmp(k);
im = ploopgen512;
gimage(im, 1); %display testimage
  1 Comment
Jan
Jan on 12 Dec 2012
Edited: Jan on 12 Dec 2012
Please learn how to format code in the forum: Empty lines on top and bottom of the code, mark code with mouse, hit "{} Code" button. An empty line after each line of code looks worse. It is so easy, but improves the readability.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 12 Dec 2012
Why does your ploopgen512 function have the line
im = ploopgen512;
??
I suspect that you forgot to delete that line and the gimage() line afterwards.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!