clc;
clear all;
close all;
x= imread ('G:\hand.png');

y= im2bw(x);
[r,c,m]= size(x);
n=y(:);
figure(1), imshow(x)
disp(y)

k=1;

for i=1:r
    for j=1:c
        z(i,j)= n(k)
        k=k+1;
    end 
end
figure(2), imshow(z')