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.

60 lines
1.6 KiB
Matlab

function Locations=test_ism_carsScale(imageNum,threshold,procLocations)
if nargin<1 || isempty(imageNum) || imageNum<0
imageNum=1
end
if nargin<2 || isempty(threshold) || threshold<0
threshold=0.95
end
spread=2
scales=1.2.^[-1:4];
method{1}='Hough';method{2}='PC/BC-DIM';
%DEFINE CODEBOOK
load('ISM_codebook_carsScale.mat');
if nargin<3 || isempty(procLocations)
Locations=postprocess_codebook(Locations,patchClassList,spread,scales);
else
Locations=procLocations;
end
%DEFINE TEST IMAGE
I=load_image_car(imageNum,4);
figured(2),clf, imagesc(I), hold on, axis('equal','tight'); title(' ');
set(gca,'FontSize',24);
set(gca,'XTick',[],'YTick',[]);
set(gcf,'PaperSize',[20 15],'PaperPosition',[0 0 20 15]);
colormap('gray');
drawnow;
%APPLY METHODS
[param{1},param{2}]=ism_compare_methods(I,patches,patchClassList,Locations,similarityThres,scales);
%display detected locations and plot bounding boxes
for m=1:length(method)
disp(method{m});
%find coordinates for which the votes exceed the threshold
index=find(param{m}{1}(4,:)>threshold.*m);
coords=param{m}{1}(1:2,index);
scale=param{m}{1}(3,index);
amplitude=param{m}{1}(4,index);
figured(5+m),clf,imagesc(I), hold on, axis('equal','tight'); title(' ');
plot_bounding_box(coords,scale);
set(gca,'XTick',[],'YTick',[]);
set(gcf,'PaperSize',[20 15],'PaperPosition',[0 0 20 15]);
colormap('gray');
drawnow;
[coords,widths]=convert_car_coordinates(coords,scale); %comment out to report centre location
[~,order]=sort(amplitude,'descend');
disp(' * amplitude:');
disp(amplitude(order));
disp(' * coords:');
disp(coords(:,order));
disp(' * scale:');
disp(scale(order));
end