1

我正在模拟热像仪效果。我在一个聚会上有一个网络摄像头指向墙前的人。我使用了背景减法技术并使用 Aforge blobcounter 得到了我想用渐变色填充的 blob。我的问题 = GetBlobsEdgePoints 不返回排序的点云,所以我不能将它与 GDI+ 中的 PathGradientBrush 一起使用来简单地绘制渐变。

  1. 我正在寻找简单、快速的算法来将 blob 跟踪到路径中(可能会出错)。
  2. 一种跟踪 blobcounter 接收到的 blob 的方法。
  3. 对其他模拟效果的方法的建议。

我快速浏览了 Emgu.CV.VideoSurveillance 但没有让它工作(示例是 v1.5,我使用 v2+)但我放弃了,因为人们说它在论坛上很慢。

谢谢阅读。

aforge背景去除示例代码

            Bitmap bmp =(Bitmap)e.VideoFrame.Clone();
        if (backGroundFrame == null)
        {
            backGroundFrame = (Bitmap)e.VideoFrame.Clone();
            difference.OverlayImage = backGroundFrame;
        }

        difference.ApplyInPlace(bmp);
        bmp = grayscale.Apply(bmp);
        threshold.ApplyInPlace(bmp);
4

2 回答 2

1

好吧,您能否发布一些 GetBlobsEdgePoints 结果的示例图像,那么如果需要图像处理算法,可能更容易理解哪些类型。

1)你可以试试贪心算法,先随机选择一个点,将该点标记为“taken”,然后选择最近的未标记为“taken”的点等等。
您需要找到合适的终止条件。如果可能有多个分离路径,您需要找出点需要多远才能成为分离路径的一部分的定义。

3)如果您有静态背景,您可以尝试在两个时间偏移的图像之间创建差异,例如相隔 200 毫秒。只需逐个像素地进行差异,并使用 abs(diff) 作为热色图中的索引。这将提供更像移动物体的边缘发光效果。

于 2010-08-22T14:46:31.317 回答
0

这是我要采取的方向(现在看起来最好):

  1. 通过我自己的逻辑在斑点上定义一组点(皮肤斑点的颜色应该更暖等..)
  2. 围绕这些点绘制渐变

                GraphicsPath gp=new GraphicsPath();
                var rect = new Rectangle(CircumferencePoint.X - radius, CircumferencePoint.Y - radius, radius*2, radius*2);
                gp.AddEllipse(rect);
                GradientShaper = new PathGradientBrush(gp);
                GradientShaper.CenterColor = Color.White;
                GradientShaper.SurroundColors = surroundingColors;
                drawBmp.FillPath(GradientShaper,gp);
    
  3. 用斑点形状掩盖那些渐变

                blobCounter.ExtractBlobsImage(bmp,blob,true);
                mask.OverlayImage = blob.Image;
                mask.ApplyInPlace(rslt);
    
  4. 用颜色重新映射着色

tnx 的帮助@Albin

于 2010-08-23T12:42:45.607 回答