while 1 newIcap = cam.snapshot(); newI = newIcap(:,:,2); newBW = segment(newI, th); [newCx, newCy] = processImage(newBW, M, R); z = sqrt((calibratedCy-newCy).^2 + (calibratedCx-newCx).^2); zz = imresize(z,[480, 640]); figure(1); cla(); hold('on'); imagesc(zz(end:-1:1,:), 'alphadata',0.2) quiver(calibratedCy, calibratedCx, calibratedCy-newCy, calibratedCx-newCx,'linewidth',2); axis([1 640 1 480]) drawnow() end