error while using rgb2gray

조회 수: 3 (최근 30일)
matlab_image
matlab_image 2012년 7월 31일
???Error using ==>rgb2gray>parse_inputs at 82 MAP must be a m*3 array.
Error in ==>rgb2gray at 35 X=parse_inputs(varargin{:});
Error in ==>match at 167 im1=(double(rgb2gray(I)));
Can anyone please tell me why rgb2gray is showing problem.And what is meaning of error.
  댓글 수: 2
Ryan
Ryan 2012년 7월 31일
What class/size is I?
matlab_image
matlab_image 2012년 7월 31일
Thanks dear but the problem got solved by changing I to Img.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2012년 7월 31일
First of all, pick a different name than I. I looks too much like 1 and l. Maybe use rgbImage. Then say "whos I" on the command line and see what it says. Also, you don't need the parentheses around the double() command. So you can do something like
whos rgbImage
size(rgbImage)
doubleRGBImage = double(rgb2gray(rgbImage));
If you still can't figure it out, come back here and tell us what else you learned. My guess is that your I is not a normal color image with 3 color channels.
  댓글 수: 1
matlab_image
matlab_image 2012년 7월 31일
Thanks a lot Image Analyst. I have just changed I to Img and now it works. Thanks again.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by