function [ vect ] = im2vect( img )

img=double(img);
[m,n,o]=size(img);


if o==3
    vect(:,3)=(reshape(img(:,:,1),m*n,1));
    vect(:,4)=(reshape(img(:,:,2),m*n,1));
    vect(:,5)=(reshape(img(:,:,3),m*n,1));
    l=1;
    for j=1:n
        for i=1:m        
            vect(l,1)=i;
            vect(l,2)=j;
            l=l+1;
        end
    end
end
%% sedy
if o==1
    vect(:,3)=uint16(reshape(img,m*n,1));
    l=1;
    for j=1:n
        for i=1:m        
            vect(l,1)=i;
            vect(l,2)=j;
            l=l+1;
        end
    end
end

end

