Using quick shift to find superpixels

 

FROM:http://www.vlfeat.org/overview/quickshift.html

 

Quick shift is a mode seeking algorithm (like mean shift) which instead of iteratively shifting each point towards a local mean instead forms a tree of links to the nearest neighbor which increases the density. For a more in-depth description of the algorithm, see our API reference for quick shift

Using quick shift to find superpixels

This demo shows quick shift in a simple superpixelization problem where we seek to segment this image:

The image we wish to segment

As a feature vector, we choose the LAB colorspace representation of the image augmented with the x,y location of the pixel. vl_quickseg is a convenient wrapper function which takes care of the transformation of the image to LAB and performs segmentation, making our job as easy as:

ratio = 0.5;
kernelsize = 2;
Iseg = vl_quickseg(I, ratio, kernelsize, maxdist);

where ratio is the tradeoff between color importance and spatial importance (larger values give more importance to color), kernelsize is the size of the kernel used to estimate the density, and maxdist is the maximum distance between points in the feature space that may be linked if the density is increased.

 

The effect of maxdist on the superpixelization. As we increase maxdist, superpixels become larger and larger since we can link less similar points. Top: maxdist=10. Bottom: maxdist=20.

Multiple segmentations

Quick shift arranges all of the data points into a tree where parents in the tree are the nearest neighbors in the feature space which increase the estimate of the density. By imposing a limit on the distance between nearest neighbors (maxdist), we decrease the amount of computation required to search for the nearest neighbors. However, we also break our tree into a forest, because local modes of the density will now have no neighbor which is close enough in the feature space to form a link.

In the previous section, we created a superpixel segmentation by taking each of the trees in this forest as a distinct cluster. However, since maxdist simply prevents new links from forming, the segmentation formed by every dist < maxdist is contained in the result. vl_quickvis lets us visualize this by running quick shift once and forming multiple segmentations by cutting links in the tree which are smaller and smaller.

maxdist = 50;
ndists = 10;
Iedge = vl_quickvis(I, ratio, kernelsize, maxdist, ndists)
imagesc(Iedge);
axis equal off tight;
colormap gray;

A visualization of multiple maxdist thresholds on a single image. Here, boundaries are colored by the largest maxdist where the boundary is preserved.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值