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.
49 lines
1.3 KiB
Matlab
49 lines
1.3 KiB
Matlab
function test_ism_horses(imageNum,threshold)
|
|
if nargin<1 || isempty(imageNum) || imageNum<0
|
|
imageNum=101
|
|
end
|
|
if nargin<2 || isempty(threshold) || threshold<0
|
|
threshold=1
|
|
end
|
|
spread=2
|
|
|
|
method{1}='Hough';method{2}='PC/BC-DIM';
|
|
|
|
%DEFINE CODEBOOK
|
|
load('ISM_codebook_horses.mat');
|
|
Locations=postprocess_codebook(Locations,patchClassList,spread);
|
|
|
|
%DEFINE TEST IMAGE
|
|
[I,groundtruth]=load_image_horse(imageNum);
|
|
%I=load_image_car(imageNum+2,3);groundtruth=[];
|
|
I=padarray(I,[4,4],'replicate','both');
|
|
groundtruth=padarray(groundtruth,[4,4],0,'both');
|
|
pos_true=centroid(groundtruth)';
|
|
figured(2),clf, imagesc(I), hold on, axis('equal','tight'); title(' ');
|
|
plot(pos_true(1),pos_true(2),'co')
|
|
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
|
|
for m=1:length(method)
|
|
disp(method{m});
|
|
|
|
index=find(param{m}{1}(3,:)>threshold);
|
|
coords=param{m}{1}(1:2,index);
|
|
amplitude=param{m}{1}(3,index);
|
|
|
|
[~,order]=sort(amplitude,'descend');
|
|
disp(' * amplitude:');
|
|
disp(amplitude(order));
|
|
disp(' * centre coords:');
|
|
disp(coords(:,order));
|
|
disp(' * distance from true centre:');
|
|
disp(sqrt(sum(bsxfun(@minus,coords,pos_true).^2)))
|
|
end
|