function  X  =  Im2Patch_RGB( im, Patch_size )
f       =   Patch_size;
N       =   size(im,1)-f+1;
M       =   size(im,2)-f+1;
L       =   N*M;
X_R       =   zeros(f*f, L, 'single');
X_G       =   zeros(f*f, L, 'single');
X_B       =   zeros(f*f, L, 'single');
X       =   zeros(f*f, L, 3, 'single');
k       =   0;
for i  = 1:f
    for j  = 1:f
        k    =  k+1;
        blk_R  =  im(i:end-f+i,j:end-f+j,1);
        blk_G  =  im(i:end-f+i,j:end-f+j,2);
        blk_B  =  im(i:end-f+i,j:end-f+j,3);
        X_R(k,:) =  blk_R(:)';
        X_G(k,:) =  blk_G(:)';
        X_B(k,:) =  blk_B(:)';
    end
end

X(:,:,1) = X_R;
X(:,:,2) = X_G;
X(:,:,3) = X_B;