clc;im=lmread('peppers.tif');[row col byt]=size(im);a=im(:,:,1);b=im(:,:,2);c=im(:,:,3);a=double(a);b=double(b);c=double(c);for x=1:1:rowfor y=1:1:colnew=(a(x,y)+b(x,y)+c(x,y))/3;new1=0.3*a(x,y)+0.59*b(x,y)+0.11*c(x,y);endendfigure (1)imshow(uint8(im))figure (2)imshow(uint8(new))figure (3)imshow(uint8(new1))
MATLAB: Error message:in an assignment A(i) =b the number of elements in b and i must be same
colorgroup(p)=group
Best Answer