跟踪物体的边界框/感兴趣区域(BoundingBox/ROI)的大小不断增加,尽管初始大小固定。

9

我正在尝试使用媒体流追踪器(Media Flow Tracker)来跟踪手部位置,但是边框大小会在一段时间后持续增加。在最开始的10秒钟内,它可以正常工作。

以下是代码片段:

def main():
display = SimpleCV.Display()
cam = Kinect()
ts = []
bb = None
img = cam.getDepth().flipHorizontal()
while display.isNotDone():
    depth = cam.getDepth().flipHorizontal()
    filtered = depth.stretch(0, 180).binarize().dilate(1)

    if bb is None:
        blobs = filtered.findBlobs()
        if blobs:
            hand = blobs.filter(abs(7000 - blobs.area()) < 500)
            print hand
            if hand:
                bb = hand[0].boundingBox()
                print bb
    if bb is not None:
        ts = filtered.track("mftrack", ts, img, bb)
        if ts:
            ts.drawBB()
            ts.showPixelVelocityRT()
            ts.drawPath()
    filtered.show()
1个回答

3
我建议将以下行中的 dilate 调用移除: filtered = depth.stretch(0, 180).binarize().dilate(1) 从 SimpleCV 的文档中可以看到:
应用形态学膨胀,膨胀的效果是平滑斑点并增强噪声斑点的数量。这个实现使用默认的openCV 3x3正方形内核。腐蚀实际上是一个局部最大值检测器,内核移动在图像上并在内核内取最大值。
变量filtered在每个循环迭代中与filtered.findBlobs()一起使用。这些斑点的强度和密度用于确定边界框的尺寸。
你在调用stretch函数时同时调用了 dilate。随着时间的推移,对dilate的调用会导致将噪声检测为手的一部分,因此边界框会相应地增加。

1
我会尝试一下然后告诉你。 - Rahat Mahbub
我看到了一些改进,但问题仍然存在。 - Rahat Mahbub
1
我将奖励分配给您,因为您做出了不错的改进,但是问题仍然保持开放状态。 - Rahat Mahbub
1
实际上有相当多的选择,我发现180对我来说效果最好。 - Rahat Mahbub
让我们在聊天中继续这个讨论 - Rahat Mahbub
显示剩余3条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接