This question is closed. Reopen it to edit or answer.
why this gives me "Index exceeds matrix dimensions?" can any one help me. Thanks in advance
1 view (last 30 days)
img = imshow(stretched_CIR);
title('CIR after Decorrelation Stretch');
h = imfreehand;
m = createMask(h, img);
% Extract individual color channels
r = img(:,:,1);
g = img(:,:,2);
b = img(:,:,3);
%Now I evaluate for RGB color channels;
>> r = img(:,:,1);
>> g = img(:,:,2);
Index exceeds matrix dimensions.
Matthew Eicholtz on 5 Oct 2016
Are you sure the image is RGB instead of grayscale? As the error suggests, the variable img must not have a 2 layer in the 3rd dimension.