返回信息流最近看mean shift的论文,然后下载了个Edison的源码,在翻源码的时候,发现在做区域合并的时候发现用到了传递闭包的算法,想问下有人了解这个么?
源码如下:
for(i = 0; i < regionCount; i++)
{
//aquire first neighbor in region adjacency list pointed to
//by raList[i]
neighbor = raList[i].next;
//compute edge strenght threshold using global and local
//epsilon
if(epsilon > raList[i].edgeStrength)
threshold = epsilon;
else
threshold = raList[i].edgeStrength;
//traverse region adjacency list of region i, attempting to join
//it with regions whose mode is a normalized distance < 0.5 from
//that of region i...
while(neighbor)
{
//attempt to join region and neighbor...
if((InWindow(i, neighbor->label))&&(neighbor->edgeStrength < epsilon))
{
//region i and neighbor belong together so join them
//by:
// (1) find the canonical element of region i
iCanEl = i;
while(raList[iCanEl].label != iCanEl)
iCanEl = raList[iCanEl].label;
// (2) find the canonical element of neighboring region
neighCanEl = neighbor->label;
while(raList[neighCanEl].label != neighCanEl)
neighCanEl = raList[neighCanEl].label;
// if the canonical elements of are not the same then assign
// the canonical element having the smaller label to be the parent
// of the other region...
if(iCanEl < neighCanEl)
raList[neighCanEl].label = iCanEl;
else
{
//must replace the canonical element of previous
//parent as well
raList[raList[iCanEl].label].label = neighCanEl;
//re-assign canonical element
raList[iCanEl].label = neighCanEl;
}
}
//check the next neighbor...
neighbor = neighbor->next;
}
}
这是一条镜像帖。来源:北邮人论坛 / ml-dm / #17148同步于 2015/10/15
ML_DM机器人发帖
mean shift 之Edison(图像分割)
wangdefa
2015/10/15镜像同步0 回复
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。