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.

51 lines
1.4 KiB
Matlab

function test_ism_cars(imageNum,threshold)
if nargin<1 || isempty(imageNum) || imageNum<0
imageNum=1
end
if nargin<2 || isempty(threshold) || threshold<0
threshold=2.5
end
spread=2
method{1}='Hough';method{2}='PC/BC-DIM';
%DEFINE CODEBOOK
load('ISM_codebook_cars.mat');
Locations=postprocess_codebook(Locations,patchClassList,spread);
%DEFINE TEST IMAGE
I=load_image_car(imageNum,3);
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);
%display detected locations and plot bounding boxes
for m=1:length(method)
disp(method{m});
index=find(param{m}{1}(3,:)>threshold.*m);
coords=param{m}{1}(1:2,index);
amplitude=param{m}{1}(3,index);
figured(5+m),clf,imagesc(I), hold on, axis('equal','tight'); title(' ');
plot_bounding_box(coords,[]);
set(gca,'XTick',[],'YTick',[]);
set(gcf,'PaperSize',[20 15],'PaperPosition',[0 0 20 15]);
colormap('gray');
drawnow;
[coords,widths]=convert_car_coordinates(coords); %comment out to report centre location
[~,order]=sort(amplitude,'descend');
disp(' * amplitude:');
disp(amplitude(order));
disp(' * coords:');
disp(coords(:,order));
end