cv.HfsSegment - MATLAB File Help | Go to online doc for cv.HfsSegment |
Hierarchical Feature Selection for Efficient Image Segmentation
This class contains an efficient algorithm to segment an image. The implementation is based on the paper [cheng2016hfs], Project page, Code
The HFS algorithm is executed in 3 stages:
In the first stage, the algorithm uses SLIC (simple linear iterative clustering) algorithm to obtain the superpixel of the input image.
In the second stage, the algorithm views each superpixel as a node in the graph. It will calculate a feature vector for each edge of the graph. It then calculates a weight for each edge based on the feature vector and trained SVM parameters. After obtaining weight for each edge, it will exploit EGB (Efficient Graph-based Image Segmentation) algorithm to merge some nodes in the graph thus obtaining a coarser segmentation. After these operations, a post process will be executed to merge regions that are smaller than a specific number of pixels into their nearby region.
In the third stage, the algorithm exploits the similar mechanism to further merge the small regions obtained in the second stage into even coarser segmentation.
After these three stages, we can obtain the final segmentation of the image. For further details about the algorithm, please refer to the original paper [cheng2016hfs].
% read an image
img = imread('image.jpg')
% create engine
seg = cv.HfsSegment(size(img,1), size(img,2));
% perform segmentation
% (res is an RGB image by default,
% change the second parameter to "false" to get a matrix of indices)
res = seg.performSegment(img, 'Draw',true);
[cheng2016hfs]:
M. Cheng, Y. Liu, Q. Hou, J. Bian, P. Torr, S. Hu, Z. Tu. "HFS: Hierarchical Feature Selection for Efficient Image Segmentation". European Conference on Computer Vision (ECCV) 2016, pp 867-882. PDF
Superclasses | handle |
Sealed | false |
Construct on load | false |
HfsSegment | Creates an HFS object |
MinRegionSizeI | This parameter is used in the second stage mentioned above. After |
MinRegionSizeII | This parameter is used in the third stage mentioned above. It serves |
NumSlicIter | This parameter is used in the first stage. It describes how many |
SegEgbThresholdI | This parameter is used in the second stage mentioned above. It is a |
SegEgbThresholdII | This parameter is used in the third stage mentioned above. It serves |
SlicSpixelSize | This parameter is used in the first stage mentioned above (the SLIC |
SpatialWeight | This parameter is used in the first stage mentioned above (the SLIC |
id | Object ID |
addlistener | Add listener for event. | |
delete | Destructor | |
eq | == (EQ) Test handle equality. | |
findobj | Find objects matching specified conditions. | |
findprop | Find property of MATLAB handle object. | |
ge | >= (GE) Greater than or equal relation for handles. | |
gt | > (GT) Greater than relation for handles. | |
Sealed | isvalid | Test handle validity. |
le | <= (LE) Less than or equal relation for handles. | |
listener | Add listener for event without binding the listener to the source object. | |
lt | < (LT) Less than relation for handles. | |
ne | ~= (NE) Not equal relation for handles. | |
notify | Notify listeners of event. | |
performSegment | Do segmentation |
ObjectBeingDestroyed | Notifies listeners that a particular object has been destroyed. |