-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvisualRank.m
More file actions
67 lines (47 loc) · 1.81 KB
/
visualRank.m
File metadata and controls
67 lines (47 loc) · 1.81 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
%Define Function
function [sortIndex, imgs, highest, lowest] = visualRank(filenames,offset,A)
A(A < 0) = 0; % replace negative values with zero
[rows, columns] = size(A); %count rows and columns in matrix
for i = 1:1:rows %Count through matrix setting diagonals to zero
A(i,i) = 0;
end
% Visualise result
figure('Name', 'A - Remove negative elements and diagonals')
im2 = imagesc(A);
title('A - Remove negative elements and diagonals')
colorbar % add color bar to visualisation
H = normalize(A,2,'norm',1);
J(1:rows,1:columns) = 1/rows;
d = 0.85;
Htilde = d*H + (1-d)*J;
V0 = zeros(1,columns);
V0(1) = 1;
V = V0 * Htilde; %V(1:rows)
for n = 1:1:49 % produce a matrix 50x1400
V(n+1,:) = V(n,:) * Htilde;
end
r = V(50,:);
%Display r vector
disp(strcat("r Vector: "))
r
[Value1,I] = max(r); % highest rank [Value, Index]
[Value2,J] = min(r); % lowest rank [Value, Index]
[Value3,sortIndex] = sort(r,'descend');
imgs = "" + fullfile('MPEG7',filenames(sortIndex))
filenames(I+offset); % highest ranked filename
filenames(J+offset); % lowest ranked filename
imghigh = "" + fullfile('MPEG7',filenames(I+offset));
imglow = "" + fullfile('MPEG7',filenames(J+offset));
figure('Name','Highest Ranked Image');
imshow(imghigh)
title('Highest Ranked Image')
highest = imshow(imghigh);
figure('Name','Lowest Ranked Image');
imshow(imglow)
title('Lowest Ranked Image')
lowest = imshow(imglow);
%Display highest ranked image filename
disp(strcat("Highest ranked image: ", imghigh))
%Display lowest ranked image filename
disp(strcat("Lowest ranked image: ", imglow))
end