Getting error about recursion limit?

1 view (last 30 days)
Usman
Usman on 30 Nov 2015
Edited: Walter Roberson on 30 Nov 2015
I have getting the recursion error upon calling function.
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your
available stack space can crash MATLAB and/or your computer.
Error in ismemberBismemberBuiltinTypes
I guess i have some problem while creating function
function image_e=eyeextract(image1)
x=mov.Height;
y=mov.Width;
image1=im2uint8(img);
figure(1),
imshow(image1);
FaceLMmine=FaceLM([ 20 23 26 29],:);
hold on;
plot( FaceLMmine(:,1), FaceLMmine(:,2), 'r*')
%find the distance between center of eyes
left_eye_ct=(FaceLM(23,1)+FaceLM(20,1))/2; %Centre of left eye xaxis
left_eye_yct=(FaceLM(23,2)+FaceLM(20,2))/2; %Centre of left eye yaxis
hold on;plot(left_eye_ct,left_eye_yct,'b*'); %Test plot for left eye check
right_eye_ct=(FaceLM(26,1)+FaceLM(29,1))/2; %Centre of right eye xaxis
right_eye_yct=(FaceLM(26,2)+FaceLM(29,2))/2; %Centre of right eye yaxis
hold on;plot(right_eye_ct,right_eye_yct,'b*');
ED=right_eye_ct-left_eye_ct;
%for left eye
xrm=FaceLM(23,1); %find xr as the x-coordinate of right corner of eye
xlm=FaceLM(20,1); %find xl as the x-coordinate of left corner of eye
yrm=FaceLM(23,2); %find yr as the y-coordinate of right corner of eye
ylm=FaceLM(20,2); %find yl as the y-coordinate of left corner of eye
x1fmr=round(xrm);
y1fmr=round(yrm-0.40*ED);
x2fmr=round(xlm);
y2fmr=round(ylm+0.30*ED);
xroi_fmr=[x1fmr x2fmr x2fmr x1fmr x1fmr]; %x and y exchanged due to interpretation
yroi_fmr=[y2fmr y2fmr y1fmr y1fmr y2fmr]; %x and y exchanged due to interpretation
fmr_roi=uint8(poly2mask(xroi_fmr,yroi_fmr,x,y));
fmr_ext=fmr_roi.*a;
subplot(2,2,1)
image_e1=croppedimage(fmr_ext);
title('left');
imwrite(image,'left_close.png');
% figure,
%for right eyes
xrm1=FaceLM(26,1); %find xr as the x-coordinate of right corner of eye
xlm1=FaceLM(29,1); %find xl as the x-coordinate of left corner of eye
yrm1=FaceLM(26,2); %find yr as the y-coordinate of right corner of eye
ylm1=FaceLM(29,2); %find yl as the y-coordinate of left corner of eye
x3fmr=round(xrm1);
y3fmr=round(yrm1-0.40*ED);
x4fmr=round(xlm1);
y4fmr=round(ylm1+0.30*ED);
xroi_fmr1=[x3fmr x4fmr x4fmr x3fmr x3fmr]; %x and y exchanged due to interpretation
yroi_fmr1=[y4fmr y4fmr y3fmr y3fmr y4fmr]; %x and y exchanged due to interpretation
fmr_roi1=uint8(poly2mask(xroi_fmr1,yroi_fmr1,x,y));
fmr_ext1=fmr_roi1.*a;
subplot(2,2,2)
image_e=croppedimage(fmr_ext1);
title('right')
imwrite(image1,'right.png');
  1 Comment
Star Strider
Star Strider on 30 Nov 2015
Somewhere in your code (or the other functions you have created), you most likely have a function calling itself from within the same function.
I do not see it in the code you posted, so you will have to go through the code for your functions to find that line, and fix the problem.

Sign in to comment.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!