rendered paste bodyglobal IPD_PATH;
RGB = ReadImage(IPD_PATH + 'demos\teaset.png');
RGB=RGB(80:180,80:180,: );
//Mozliwosc 1 wbudowana
Image=RGB2Gray(RGB);
//Mozliwosc 2 funkcja
[h w d]=size(RGB);
ImageGray=zeros(h,w);
//for i = 1:h
//for j = 1:w
//ImageGray(i,j)=(uint16(RGB(i,j,1))+uint16(RGB(i,j,2))+uint16(RGB(i,j,3)))/3;
//end;
//end
//ImageGray=uint8(ImageGray);
//Mozliwosc 3 szarosc
ImageGray(:,: )=(uint16(RGB(:,:,1))+uint16(RGB(:,:,2))+uint16(RGB(:,:,3)))/3
ImageGray=uint8(ImageGray);
ShowColorImage(RGB,'Result');
ShowColorImage(ImageGray, 'Obrazek');