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

on 12 Dec 2012

Walter Roberson (view profile)

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:

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 = 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

Jan Simon

Jan Simon (view profile)

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.

Products

No products are associated with this question.

Walter Roberson (view profile)

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.

Natali

Natali (view profile)

on 12 Dec 2012

OMGGGG! had not seen that at all. thank you so much!!!

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test