forked from sergeyk/selective_search_ijcv_with_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRecreateBlobHierarchyIndIm.m
More file actions
27 lines (23 loc) · 898 Bytes
/
RecreateBlobHierarchyIndIm.m
File metadata and controls
27 lines (23 loc) · 898 Bytes
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
function [hBlobs blobsInit blobsRest] = RecreateBlobHierarchyIndIm(blobIndIm, blobBoxes, hierarchy)
% function hBlobs = RecreateBlobHierarchyIndIm(blobIndIm, boxes, hierarchy)
%
% Recreate hierarchy from the initial segmentation image
%
% blobIndIm: Image with indices denoting segments
% blobBoxes: Boxes belonging to blobs in blobIndIm
% hierarchy: Hierarchy denoting hierarchical merging
%
% hBlobs: All blobs in the hierarchy
% blobsInit: The initial blobs
% blobsRest: All blobs but the initial blobs
%
% Jasper Uijlings - 2013
% Get blobs of initial segmentation
blobsInit = SegmentIndices2Blobs(blobIndIm, blobBoxes);
% Add sizes
blobsInit = BlobAddSizes(blobsInit);
% Reconstruct hierarchy
hBlobs = RecreateBlobHierarchy(blobsInit, hierarchy);
if nargout == 3
blobsRest = hBlobs(length(blobsInit)+1:end);
end