-
Notifications
You must be signed in to change notification settings - Fork 1
/
features.m
52 lines (36 loc) · 1.12 KB
/
features.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
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
%% Feature Extraction
% This function is for extraction of features from the input image
function y = features(I)
%% Gray level co-occurrences matrix
% GLCM includes properties like:
% * Contrast
% * Entropy
% * Energy
% * Correlation
% * Homogeneity
% * Maximum likelihood
% * 3rd order moment, etc.
glcm = graycomatrix(rgb2gray(I));
%% shape features in the image
e = edge(rgb2gray(I));
%% Local binary pattern features
% lbp = extractLBPFeatures(I, 'Upright', False);
%% Gabor Filter
% imageSize = size(I);
% numRows = imageSize(1);
% numCols = imageSize(2);
%
% wavelengthMin = 4/sqrt(2);
% wavelengthMax = hypot(numRows,numCols);
% n = floor(log2(wavelengthMax/wavelengthMin));
% wavelength = 2.^(0:(n-2)) * wavelengthMin;
%
% deltaTheta = 45;
% orientation = 0:deltaTheta:(180-deltaTheta);
%
% g = gabor(wavelength,orientation);
% gabormag = imgaborfilt(rgb2gray(I),g);
%% Return of all the features calculated as a matrix
y = {glcm, e};
% y = {glcm, e, lbp, gabormag};
end