Asked by Natali
on 12 Dec 2012

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

*No products are associated with this question.*

Answer by Walter Roberson
on 12 Dec 2012

Accepted answer

Why does your ploopgen512 function have the line

im = ploopgen512;

??

I suspect that you forgot to delete that line and the gimage() line afterwards.

Opportunities for recent engineering grads.

## 1 Comment

## Jan Simon (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/56375#comment_116707

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.