-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstar.m~
More file actions
44 lines (33 loc) · 1.3 KB
/
star.m~
File metadata and controls
44 lines (33 loc) · 1.3 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
function map = star(tester)
clear;
close all;
% Directory where images can be found---ensure this is correct
imagedir = 'Images/StarTraining';
imagedir2 = 'Images/StarTest';
output = zeros(35,30);
for a = 1:35;
im = imread([imagedir, sprintf('/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
N = 30; %number of lowest frequencies to keep
filteredFFT = anglesFFT(1:N); % 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
N = 30; %number of lowest frequencies to keep
filteredFFT = anglesFFT(1:N); % Apply the filter by scalar multipliacation
training = abs(filteredFFT)/100;
themean = mean(output)
thecovariance = cov(output,1)
transposedMean = (themean)'
transposedTraining = (training)'
transposedCovariance = (thecovariance)'
map = log(35/430) - 0.5*log(det(thecovariance)) - 0.5*((transposedTraining-transposedMean)'*(thecovariance^-1)*(transposedTraining-transposedMean))