-
Notifications
You must be signed in to change notification settings - Fork 3
/
console_test_knn.m
27 lines (24 loc) · 902 Bytes
/
console_test_knn.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
cores = 2;
% kNN without enrichment
b=imread('b.png');
c=imread('c.png');
tic;
cnn=nnmex(b, b, 'cputiled', 7, 16, [], [], [], [], cores, [], [], [], [], [], 4);
toc
writeim(cnn(:,:,1,1),'test17.png')
writeim(cnn(:,:,1,2),'test18.png')
writeim(cnn(:,:,1,3),'test19.png')
writeim(cnn(:,:,1,4),'test20.png')
D = sqrt(double(cnn(:,:,3,:)));
format long;
disp(['Average dist (no enrichment):', num2str(mean(D(:)))]);
% kNN with enrichment -- both images must be the same. Enrichment requires the number of NN iterations to be even -- if not it will round down to the next even number.
tic;
cnn=nnmex(b, b, 'enrich', 7, 6, [], [], [], [], cores, [], [], [], [], [], 4);
toc
writeim(cnn(:,:,1,1),'test21.png')
writeim(cnn(:,:,1,2),'test22.png')
writeim(cnn(:,:,1,3),'test23.png')
writeim(cnn(:,:,1,4),'test24.png')
D = sqrt(double(cnn(:,:,3,:)));
disp(['Average dist (enrichment):', num2str(mean(D(:)))]);