forked from sergeyk/selective_search_ijcv_with_python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowBlobs.m
61 lines (54 loc) · 1.39 KB
/
ShowBlobs.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
57
58
59
60
61
function ShowBlobs(blobs, numRow, numCol, image, minSize, imNames)
% PlotBlobs(blobs, numRow, numCol, image, minSize) plots all blobs in numCol columns
%
% Jasper Uijlings - 2013
if nargin == 4
minSize = 0;
end
doNames = exist('imNames', 'var');
if doNames
if ~iscell(imNames)
imageNamesC = cell(size(imNames));
for i=1:length(imNames)
imageNamesC{i} = sprintf('%g', imNames(i));
end
imNames = imageNamesC;
end
end
% Convert to images
idx = 1;
for i=1:length(blobs)
if not(isfield(blobs{i}, 'size'))
blobs{i}.size = sum(sum(blobs{i}.mask));
end
if blobs{i}.size > minSize
images{idx} = Blob2Image(blobs{i}, image);
if doNames
iiNames{idx} = imNames{i};
end
idx = idx + 1;
end
end
if doNames;
ShowImageCell(images, numRow, numCol, '', iiNames);
else
ShowImageCell(images, numRow, numCol);
end
% totImages = idx - 1;
%
% numFigures = ceil(totImages / (numCol * numRow))
%
% n = 1;
% screenSize = get(0, 'ScreenSize');
%
% for i=1:numFigures
% figure('Position', [1, 1, screenSize(3)/2, screenSize(4)]);
% clf;
% for j = 1:numCol * numRow
% if(n <= totImages)
% subplot(numRow, numCol, j);
% imshow(images{n});
% n = n + 1;
% end
% end
% end