% RGB to GrayScale function [gs]=RGB2GS(rgb) % GS = 0.299R+0.587G+0.114B gs = 0.299*rgb(:,:,1)+0.587*rgb(:,:,2)+0.114*rgb(:,:,3); return;