function z=color2gray(X,q)
% This function creates a gray scale image of any input X
%returns the double of the gray scaled image
%enter true to generate the gray scale image, false to bypass graph
x=imread(X);
x=double(x);
r=x(:,:,1);g=x(:,:,2);b=x(:,:,3);
xgray=0.2126*r+0.7152*g+0.0722*b;
z=xgray;
if q==true
    figure;
    subplot(1,2,1)
    imagesc(uint8(x));
    title('Original Image');
    subplot(1,2,2)
    imagesc(uint8(z));colormap(gray);
    title('Gray Scale Image');
end
end