This error was occurred when I was testing the Example of the " Multilevel image thresholds using Otsu's method" in Matlab 2015a. Can you please tell me why this error occurred and how to solve this?
link to the example : -
openExample('images/CompareThresholdingEntireImageVersusPlanebyplaneThresholExample')
>> I = imread('circlesBrightDark.png');
>> imshow(I)
Warning: Image is too big to fit on screen; displaying at 67%
> In images.internal.initSize (line 71)
In imshow (line 305)
>> axis off
>> title('Original Image')
>> thresh = multithresh(I,2);
>> seg_I = imquantize(I,thresh);
>> RGB = label2rgb(seg_I);
Error using label2rgb
Expected input number 1, L, to be two-dimensional.
Error in label2rgb>parse_inputs (line 128)
validateattributes(L,{'numeric','logical'}, ...
Error in label2rgb (line 49)
[label,map,zerocolor,order,fcnflag] = parse_inputs(varargin{:});

 채택된 답변

Walter Roberson
Walter Roberson 2016년 9월 14일

2 개 추천

You need to convert your image to greyscale to use that function.

댓글 수: 4

thar
thar 2016년 9월 14일
I used the original image from the example by downloading it. DO i have to convert it to greyscale ?
This is the image i used
http://in.mathworks.com/help/examples/images/SegmentImageIntoThreeLevelsUsingTwoThresholdsExample_01.png
Walter Roberson
Walter Roberson 2016년 9월 14일
Yes. Although the image only visually looks like grayscale, it is an RGB image.
thar
thar 2016년 9월 15일
Thank you very much.
ThankGod Alexander
ThankGod Alexander 2022년 7월 30일
Thank you very much for this answer. I just encountered it and a quick search gave your answer and I was able to fix it

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2016년 9월 14일

댓글:

2022년 7월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by