pulling data and images
@ -25,6 +25,7 @@ OUT_FOLDER = 'descriptors';
|
||||
% OUT_SUBFOLDER='avgRGB';
|
||||
OUT_SUBFOLDER='globalRGBhisto';
|
||||
% OUT_SUBFOLDER='spatialColour';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialTexture';
|
||||
% OUT_SUBFOLDER='spatialColourTexture';
|
||||
|
||||
allfiles=dir (fullfile([DATASET_FOLDER,'/Images/*.bmp']));
|
||||
@ -38,8 +39,9 @@ for filenum=1:length(allfiles)
|
||||
|
||||
%% EXTRACT FUNCTION
|
||||
% F=extractAvgRGB(img);
|
||||
F=extractGlobalColHist(img);
|
||||
F=extractGlobalColHist(img, 2, 1, 8, 0.05);
|
||||
% F=extractSpatialColour(img, 2, 1);
|
||||
% F=extractSpatialTexture(img, 2, 1, 8, 0.05);
|
||||
% F=extractSpatialColourTexture(img);
|
||||
save(fout,'F');
|
||||
toc
|
||||
|
@ -30,6 +30,7 @@ DESCRIPTOR_FOLDER = 'descriptors';
|
||||
% DESCRIPTOR_SUBFOLDER='avgRGB';
|
||||
DESCRIPTOR_SUBFOLDER='globalRGBhisto';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialColour';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialTexture';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialColourTexture';
|
||||
|
||||
CATEGORIES = ["Farm Animal"
|
||||
|
@ -30,6 +30,7 @@ DESCRIPTOR_FOLDER = 'descriptors';
|
||||
DESCRIPTOR_SUBFOLDER='avgRGB';
|
||||
% DESCRIPTOR_SUBFOLDER='globalRGBhisto';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialColour';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialTexture';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialColourTexture';
|
||||
|
||||
CATEGORIES = ["Farm Animal"
|
||||
|
@ -30,6 +30,7 @@ DESCRIPTOR_FOLDER = 'descriptors';
|
||||
% DESCRIPTOR_SUBFOLDER='avgRGB';
|
||||
DESCRIPTOR_SUBFOLDER='globalRGBhisto';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialColour';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialTexture';
|
||||
% DESCRIPTOR_SUBFOLDER='spatialColourTexture';
|
||||
|
||||
CATEGORIES = ["Farm Animal"
|
||||
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
BIN
data/data.ods
BIN
data/edgeThresholds/10_14_flower_edge.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
data/edgeThresholds/10_14_s.png
Normal file
After Width: | Height: | Size: 109 KiB |
BIN
data/edgeThresholds/5_15_cow_edge.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
data/edgeThresholds/5_15_s.png
Normal file
After Width: | Height: | Size: 134 KiB |
BIN
data/edgeThresholds/cow-t-0.01.png
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
data/edgeThresholds/cow-t-0.05.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
data/edgeThresholds/cow-t-0.08.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
data/edgeThresholds/cow-t-0.1.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
data/edgeThresholds/cow-t-0.2.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
data/edgeThresholds/flower-t-0.005.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
data/edgeThresholds/flower-t-0.01.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
data/edgeThresholds/flower-t-0.02.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
data/edgeThresholds/flower-t-0.05.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
data/edgeThresholds/flower-t-0.08.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
data/edgeThresholds/flower-t-0.1.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
data/edgeThresholds/flower-t-0.2.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
data/edgeThresholds/flower-t-0.3.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
data/spatialTexture/map-bin-vary.png
Normal file
After Width: | Height: | Size: 20 KiB |
@ -1,7 +1,4 @@
|
||||
function F=extractSpatialColourTexture(img)
|
||||
|
||||
grid_rows = 8;
|
||||
grid_columns = 8;
|
||||
function F=extractSpatialColourTexture(img, grid_rows, grid_columns, bins, threshold)
|
||||
|
||||
img_size = size(img);
|
||||
img_rows = img_size(1);
|
||||
@ -43,7 +40,7 @@ for i = 1:grid_rows
|
||||
avg_vals = extractAvgRGB(img_cell);
|
||||
[mag_img, angle_img] = getEdgeInfo(grey_img_cell);
|
||||
|
||||
edge_hist = getEdgeAngleHist(mag_img, angle_img, 8, 0.05);
|
||||
edge_hist = getEdgeAngleHist(mag_img, angle_img, bins, threshold);
|
||||
|
||||
%concatenate average values into vector
|
||||
descriptor = [descriptor edge_hist avg_vals(1) avg_vals(2) avg_vals(3)];
|
||||
|
50
descriptor/extractSpatialTexture.m
Normal file
@ -0,0 +1,50 @@
|
||||
function F=extractSpatialTexture(img, grid_rows, grid_columns, bins, threshold)
|
||||
|
||||
img_size = size(img);
|
||||
img_rows = img_size(1);
|
||||
img_cols = img_size(2);
|
||||
|
||||
row_divs = [];
|
||||
for i = 1:grid_rows
|
||||
row_divs(i) = i/grid_rows;
|
||||
end
|
||||
col_divs = [];
|
||||
for i = 1:grid_columns
|
||||
col_divs(i) = i/grid_columns;
|
||||
end
|
||||
|
||||
descriptor = [];
|
||||
%% divide image into sectors as defined grid parameters
|
||||
for i = 1:grid_rows
|
||||
for j = 1:grid_columns
|
||||
|
||||
% cell row pixel range
|
||||
row_start = round( (i-1)*img_rows/grid_rows );
|
||||
if row_start == 0
|
||||
row_start = 1;
|
||||
end
|
||||
row_end = round( i*img_rows/grid_rows );
|
||||
|
||||
% cell column pixel range
|
||||
col_start = round( (j-1)*img_cols/grid_columns );
|
||||
if col_start == 0
|
||||
col_start = 1;
|
||||
end
|
||||
col_end = round( j*img_cols/grid_columns );
|
||||
|
||||
% grab cell from parameters as above
|
||||
img_cell = img(row_start:row_end, col_start:col_end, :);
|
||||
grey_img_cell = getGreyscale(img_cell);
|
||||
|
||||
[mag_img, angle_img] = getEdgeInfo(grey_img_cell);
|
||||
|
||||
edge_hist = getEdgeAngleHist(mag_img, angle_img, bins, threshold);
|
||||
|
||||
%concatenate average values into vector
|
||||
descriptor = [descriptor edge_hist];
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
F=descriptor;
|
||||
return;
|
@ -61,8 +61,10 @@ QUERY_INDEXES=[301 358 384 436 447 476 509 537 572 5 61 80 97 127 179 181 217 26
|
||||
|
||||
map = [];
|
||||
|
||||
for b=1:3
|
||||
for c=1:3
|
||||
thresholded = [0.01:0.01:0.15];
|
||||
|
||||
for b=1:15
|
||||
% for c=1:10
|
||||
|
||||
%% 1) Load all the descriptors into "ALLFEAT"
|
||||
%% each row of ALLFEAT is a descriptor (is an image)
|
||||
@ -71,23 +73,6 @@ ALLFEAT=[];
|
||||
ALLFILES=cell(1,0);
|
||||
ALLCATs=[];
|
||||
ctr=1;
|
||||
% allfiles=dir (fullfile([DATASET_FOLDER,'/Images/*.bmp']));
|
||||
% for filenum=1:length(allfiles)
|
||||
% fname=allfiles(filenum).name;
|
||||
%
|
||||
% %identify photo category for PR calculation
|
||||
% split_string = split(fname, '_');
|
||||
% ALLCATs(filenum) = str2double(split_string(1));
|
||||
%
|
||||
% imgfname_full=([DATASET_FOLDER,'/Images/',fname]);
|
||||
% img=double(imread(imgfname_full))./255;
|
||||
% thesefeat=[];
|
||||
% featfile=[DESCRIPTOR_FOLDER,'/',DESCRIPTOR_SUBFOLDER,'/',fname(1:end-4),'.mat'];%replace .bmp with .mat
|
||||
% load(featfile,'F');
|
||||
% ALLFILES{ctr}=imgfname_full;
|
||||
% ALLFEAT=[ALLFEAT ; F];
|
||||
% ctr=ctr+1;
|
||||
% end
|
||||
|
||||
allfiles=dir (fullfile([DATASET_FOLDER,'/Images/*.bmp']));
|
||||
for filenum=1:length(allfiles)
|
||||
@ -104,8 +89,9 @@ for filenum=1:length(allfiles)
|
||||
%% EXTRACT FUNCTION
|
||||
% F=extractAvgRGB(img);
|
||||
% F=extractGlobalColHist(img);
|
||||
F = extractSpatialColour(img, b, c);
|
||||
% F=extractSpatialColourTexture(img);
|
||||
% F = extractSpatialColour(img, b, c);
|
||||
F=extractSpatialTexture(img, 4, 4, 7, thresholded(1,b));
|
||||
% F=extractSpatialColourTexture(img, b, c, 8, 0.08);
|
||||
% toc
|
||||
|
||||
ALLFEAT=[ALLFEAT ; F];
|
||||
@ -150,9 +136,9 @@ for iteration=1:CAT_TOTAL
|
||||
|
||||
query_row = dst(1,:);
|
||||
query_category = query_row(1,3);
|
||||
if query_category ~= iteration
|
||||
dst
|
||||
end
|
||||
% if query_category ~= iteration
|
||||
% dst
|
||||
% end
|
||||
fprintf('category was %s\n', CATEGORIES(query_category))
|
||||
|
||||
dst = dst(2:NIMG, :);
|
||||
@ -272,9 +258,11 @@ AP_sd = std(AP_values)
|
||||
% xlabel('Run');
|
||||
% ylabel('Average Precision');
|
||||
|
||||
fprintf('%i,%i %i', b, c, MAP);
|
||||
% fprintf('%i,%i %i', b, c, MAP);
|
||||
fprintf('%i,%i', b, MAP);
|
||||
|
||||
map(b, c) = MAP;
|
||||
% map(b, c) = MAP;
|
||||
map(b) = MAP;
|
||||
|
||||
end
|
||||
% end
|
||||
end
|
@ -1123,9 +1123,6 @@ Mean precision recall curve for histogram
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_inset Float figure
|
||||
wide false
|
||||
sideways false
|
||||
@ -1179,7 +1176,7 @@ status open
|
||||
\align center
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/spatialColour/mapSurface2.png
|
||||
lyxscale 40
|
||||
lyxscale 20
|
||||
width 50col%
|
||||
|
||||
\end_inset
|
||||
@ -1187,7 +1184,7 @@ status open
|
||||
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/spatialColour/mapSurfaceWithMax.png
|
||||
lyxscale 40
|
||||
lyxscale 20
|
||||
width 50col%
|
||||
|
||||
\end_inset
|
||||
@ -1222,12 +1219,279 @@ name "fig:glo-col-hist-map-surfaces"
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
Spatial Texture
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_inset Float figure
|
||||
wide false
|
||||
sideways false
|
||||
status open
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Plain Layout
|
||||
\align center
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/10_14_s.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset space \quad{}
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/10_14_flower_edge.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Caption Standard
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Image 10_14_s from the flower category followed by visualisation of detected
|
||||
edges
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Float figure
|
||||
wide false
|
||||
sideways false
|
||||
status open
|
||||
|
||||
\begin_layout Plain Layout
|
||||
\align center
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/5_15_s.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset space \quad{}
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/5_15_cow_edge.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Caption Standard
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Image 5_15_s from the cow category followed by visualisation of detected
|
||||
edges
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Float figure
|
||||
wide false
|
||||
sideways false
|
||||
status open
|
||||
|
||||
\begin_layout Plain Layout
|
||||
\align center
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/flower-t-0.01.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset space \quad{}
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/cow-t-0.01.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Plain Layout
|
||||
\begin_inset Caption Standard
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Angle magnitude images after threshold = 0.01
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Float figure
|
||||
wide false
|
||||
sideways false
|
||||
status open
|
||||
|
||||
\begin_layout Plain Layout
|
||||
\align center
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/flower-t-0.08.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset space \quad{}
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/cow-t-0.08.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Caption Standard
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Angle magnitude images after threshold = 0.08
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Float figure
|
||||
wide false
|
||||
sideways false
|
||||
status open
|
||||
|
||||
\begin_layout Plain Layout
|
||||
\align center
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/flower-t-0.2.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset space \quad{}
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/edgeThresholds/cow-t-0.2.png
|
||||
lyxscale 30
|
||||
width 20col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Caption Standard
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Angle magnitude images after threshold = 0.2
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Float figure
|
||||
wide false
|
||||
sideways false
|
||||
status open
|
||||
|
||||
\begin_layout Plain Layout
|
||||
\align center
|
||||
\begin_inset Graphics
|
||||
filename /home/andy/dev/matlab/cv-coursework/data/spatialTexture/map-bin-vary.png
|
||||
lyxscale 30
|
||||
width 80col%
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Caption Standard
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Mean average precision values for varying numbers of bins, grid size 4x4,
|
||||
threshold 0.08
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
Spatial Colour and Texture
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
Principal Component Analysis
|
||||
\end_layout
|
||||
|
||||
\begin_layout Section
|
||||
Discussion
|
||||
\end_layout
|
||||
|