-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRun_BOG.m
56 lines (51 loc) · 1.77 KB
/
Run_BOG.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
53
54
55
56
global page;
page = 0;
outputFolder = fullfile(tempdir, '17Flowers');
if ~exist(outputFolder, 'dir')
disp('Downloading 17-Category Flower Dataset (58 MB)...');
untar(url, outputFolder);
end
flowerImageSet = imageSet(fullfile(outputFolder,'jpg'));
if exist('savedColorBagOfFeatures.mat','file')
load('savedColorBagOfFeatures.mat','colorBag');
load('savedColorBagOfFeatures.mat', 'flowerImageIndex');
else
trainingSet = partition(flowerImageSet, 0.4, 'randomized');
% % Create a custom bag of features using the 'CustomExtractor' option
colorBag = bagOfFeatures(trainingSet, ...
'CustomExtractor', @exampleBagOfFeaturesColorExtractor,'VocabularySize', 10000);
flowerImageIndex = indexImages(flowerImageSet, colorBag, 'SaveFeatureLocations', false);
save savedColorBagOfFeature.mat
end
flowerImageIndex.WordFrequencyRange = [0.1 0.9];
[imageIDs, scores] = retrieveImages(im111, flowerImageIndex);
%save imageIDs.mat
%helperDisplayImageMontage(flowerImageSet.ImageLocation(imageIDs))
global displayImages;
for r = 1:20
displayImages(r) = image(...
'Interruptible','on',...
'Parent', imagesAxeses(r)...
);
im111 = read(flowerImageSet,imageIDs(r));
img11 = double(im111)/256;
set(displayImages(r), 'CData', img11);
openAgain= openAgain + 1;
end
% elseif page<4
% page = page + 1;
% for l = 1:20
% im222 = read(flowerImageSet, imageIDs(r));
% img22 = double(im222)/256;
% set(displayImages(l),'CData',img22);
% end
% end
set(buttonRun,'Visible','on');
% set(buttonNext,'Visible','on');
% set(buttonPrev,'Visible','off');
% if page>1
% set(buttonPrev,'Visible','on');
% end
% if page==4
% set(buttonNext,'Visible','off');
% end