Maximum Recursion limit when using rgb2gray

2 views (last 30 days)
When I try to use the function rgb2gray, I get the following error message:
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.
What is causing this error??
My code is:
>> I=imread('\\psf\Home\Desktop\Coin project\dbImages2\fotos 21 sep 5R\Sample_2015-08-12 15.39.08.221.jpg');
>> I2=rgb2gray(I);
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 rgb2gray
This happens only when I use the rgb2gray function
Thanks for your help

Accepted Answer

Walter Roberson
Walter Roberson on 7 Oct 2015
Please use
which -all rgb2gray
to find out where the files are. Chances are that you have accidentally added your own rgb2gray.m that is intended to call the "real" rgb2gray but instead calls itself.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!