function C = rgb2mono(A,c)
% A is an mA-by-nA-by-3 uint8 color array that represents an image IA
% c is an rgb vector.
% C is an mA-by-nA-by-3 uint8 color array obtained by scaling pixel
% (i,j) in IA by double(B(i,j))/255 where B = rgb2gray(A).
%
[m,n,p] = size(A);
B = rgb2gray(A);
C = zeros(m,n,p,'uint8');
for i=1:m
for j=1:n
C(i,j,1) = uint8(double(B(i,j))*c(1));
C(i,j,2) = uint8(double(B(i,j))*c(2));
C(i,j,3) = uint8(double(B(i,j))*c(3));
end
end