From: Poh Choo on 16 Nov 2009 08:59 i receive an error stated 'Index exceeds matrix dimensions'. Error in ==> ind2rgb at 27 r = zeros(size(a)); r(:) = cm(a,1); what is wrong?how to fix it? My command is: clc [X,map] = imread('C:\Documents and Settings\pohchoo\My Documents\wbc.bmp'); RGB = ind2rgb(X,map); % Convert image to L*a*b* color space cform2lab = makecform('srgb2lab'); LAB = applycform(RGB, cform2lab); % Scale values to range from 0 to 1 L = LAB(:,:,1)/100; % Perform CLAHE LAB(:,:,1) = adapthisteq(L,'NumTiles',... [8 8],'ClipLimit',0.005)*100; % Convert back to RGB color space cform2srgb = makecform('lab2srgb'); J = applycform(LAB, cform2srgb); % Display the results figure, imshow(RGB); figure, imshow(J); Hope 2 get your reply soon. Thank you.
From: Steve Eddins on 16 Nov 2009 09:38 Poh Choo wrote: > i receive an error stated 'Index exceeds matrix dimensions'. > > Error in ==> ind2rgb at 27 > r = zeros(size(a)); r(:) = cm(a,1); > what is wrong?how to fix it? > > My command is: > clc > [X,map] = imread('C:\Documents and Settings\pohchoo\My Documents\wbc.bmp'); > > RGB = ind2rgb(X,map); > > % Convert image to L*a*b* color space > cform2lab = makecform('srgb2lab'); > LAB = applycform(RGB, cform2lab); > > % Scale values to range from 0 to 1 > L = LAB(:,:,1)/100; > > % Perform CLAHE > LAB(:,:,1) = adapthisteq(L,'NumTiles',... > [8 8],'ClipLimit',0.005)*100; > > % Convert back to RGB color space > cform2srgb = makecform('lab2srgb'); > J = applycform(LAB, cform2srgb); > > % Display the results > figure, imshow(RGB); > figure, imshow(J); > > Hope 2 get your reply soon. > Thank you. Your subject line says "CLAHE-error" but the error message says the problem occurred several lines before you call adapthisteq. Hmm. Anyway, the error message suggests to me that you might have a bad image file. Specifically, the colormap contained in the file might have too few colors for the image. You can check to see whether this is true: X_max = max(X(:)); num_colors = size(map, 1); bad_image_file = X_max >= num_colors --- Steve Eddins http://blogs.mathworks.com/steve/
|
Pages: 1 Prev: plot annotation - matlab Next: Can we convert simulink *.mdl file to matlab *.m file |