As @Chris mentioned, line
corners(1:length(y),:,i) = [yx];
- a problem. An easy way to make sure that corners are truncated is to use an array of cells
max_pts = 900; cornerCell = cell(size(images,3),1); parfor i = 1:size(images,3) I = images(:,:,i); [yx] = get_corners(I,max_pts); cornerCell{i} = [yx]; end
If you do not want the angles to be an array of cells (note that to build angles for the i-th image you can call imshow(images(:,:,i),[]),hold on, plot(cornerCell{i}(:,1),cornerCell{i}(:,2),'o') ), you can always convert back to the source file 900-by-2, nImages array in a loop that won't cost you any noticeable time:
corners = zeros(max_pts,2,size(images,3)); for i=1:size(images,3) corners(1:size(cornerCell{i},1),:,i) = cornerCell{i}; end
Jonas
source share