close all;

sam = randsample(ydim*xdim,7000);
[xc, yc] = meshgrid(1:xdim, 1:ydim);
zc = ones(ydim,xdim);




rim = (R*[yc(:)';xc(:)';zc(:)']);
pim = [yc(:)';xc(:)';zc(:)'];
hold on
scatter3(rim(1,sam),rim(2,sam),rim(3,sam),3,im1(sam))
scatter3(pim(1,sam),pim(2,sam),pim(3,sam),3,im0(sam))


%scatter3(yc(sam),xc(sam),zc(sam),3,im0(sam))
