You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
816 B
Matlab

function [Iall,classList,objLocation,objRegion]=expand_horse_image_set(offset,i,Iall,classList,objLocation,objRegion,I,groundtruth,class)
scales=[0.9:0.1:1.1];
angles=[-12:12:12];
numManipulations=length(scales)*length(angles);
i=numManipulations*(offset+(i-1));
for scale=scales
for angle=angles
i=i+1;
Iall{i}=imrotate(imresize(I,'scale',scale),angle,'bilinear','crop');
classList(i)=class;
if ~isempty(groundtruth),
GT=imrotate(imresize(groundtruth,'scale',scale),angle,'bilinear','crop');
objLocation(i,1:2)=fliplr(centroid(GT));
region=single(imdilate(groundtruth,strel('disk',4)));
else
objLocation(i,:)=[NaN;NaN];
region=ones(size(I),'single');
end
objRegion{i}=single(imrotate(imresize(region,'scale',scale),angle,'bilinear','crop'));
end
end