function points=getpoints(im,cc,fc,kc); % points = getpoints(im, cc, fc, kc); % Searches the image row-by-row and looks for one point per row. % Computes point to sub-pixel accuracy (in x), converts to homogeneous % coordinates, and adds to 2xN buffer points. [r,c]=size(im); thresh = 50; % min value for a peak in a row npoints = 0; points = zeros(2,r); % can't be more than this... for i=1:r, % process row data = im(i,:); if (sum(data .* (data > thresh)) > 0), % there is at least one pixel above thresh data = conv(data,blackman(5)); data = data(3:length(data)); % shift back over to compensate for filtering [y,ndx]=max(data); [a,x0,y0]=fitparabola(data(ndx-1:ndx+1)); pt = [ndx+x0 ; i-1]; pt = comp_distortion((pt - cc) ./ fc, kc); npoints = npoints + 1; points(:,npoints) = pt; end end points = points(:,1:npoints);