-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstar.m
More file actions
30 lines (26 loc) · 1.1 KB
/
star.m
File metadata and controls
30 lines (26 loc) · 1.1 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
function map = star(tester)
frequenciesToKeep = 6;
output = zeros(35,frequenciesToKeep);
for a = 1:35;
im = imread(sprintf('Images/StarTraining/Star%1d.gif', a));
im = logical(im); %Convert the original intensity values into logical 1s and 0s
c = chainCode(im);
%% filter using the FT of the angles of the chaincode
angles = c(3,:)*(2*pi/8);
anglesFFT = fft(angles); %fast fourier transform
filteredFFT = anglesFFT(1:frequenciesToKeep); % Apply the filter by scalar multipliacation
% feature vector
output(a,:) = abs(filteredFFT)/100;
end
im = imread(tester);
im = logical(im); %Convert the original intensity values into logical 1s and 0s
c = chainCode(im);
angles = c(3,:)*(2*pi/8);
anglesFFT = fft(angles); %fast fourier transform
filteredFFT = anglesFFT(1:frequenciesToKeep); % Apply the filter by scalar multipliacation
training = abs(filteredFFT)/100;
themean = mean(output);
thecovariance = cov(output,1);
transposedMean = (themean)';
transposedTraining = (training)';
map = log(35/227) - 0.5*log(det(thecovariance)) - 0.5*((transposedTraining-transposedMean)'*(thecovariance^-1)*(transposedTraining-transposedMean));