C# 从视频源中检测人体

发布于 2024-11-24 12:03:26 字数 290 浏览 1 评论 0原文

我正在尝试从视频源中提取人,以便稍后可以使用他的图像。我只需要提取人体,而忽略环境。好处是背景是静态的。我尝试使用 AForge 并应用 CustomFrameDifferenceDetector 过滤器,它将当前帧与静态背景图像进行比较并提取不同的像素(差异>阈值)。它效果很好,但是当皮肤或部分衣服的颜色与背景颜色相似时就会出现问题。在这些情况下,过滤器会忽略这些部分,结果会在主体上出现各种孔。简单地降低阈值并不能解决问题,因为身体阴影和其他噪声会增加(即使在噪声抑制下)。

您知道这个问题有任何已知的解决方案吗?还是仍然有未解决的问题?

I am trying to extract human from a video source, so that I can use his image later. I need to only extract human body, and ignore the environment. The good thing is that the background is static. I have tried to use AForge and applied CustomFrameDifferenceDetector filter, which compares current frame to the static background image and extracts the pixels which differ (difference>threshold). It works well, but there is a problem when skin or part of the clothing has the similar color to background. In these cases filter ignores these parts and the result has various holes in the body. Simply decreasing threshold doesn't solve the problem, since body shadows and other noise increases (even under noise supression).

Do you know of any known solution to this problem? Or is it still unsolved problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玩心态 2024-12-01 12:03:26

这是一个很难解决的问题(也是微软 Kinect 不只使用可见光以及蓝/绿屏幕仍然如此流行的原因之一)。我会尝试去除洞(你应该能够预测身体的位置)。如果您有处理能力,请使用不同的阈值并合并结果。您也可以尝试过滤新的分离图像(例如,将当前帧添加到最后一帧并标准化结果)。通过这种方式,您可以更一致地跟踪一帧中丢失的形状。

另一种方法:仅使用检测到的形状/区域来检测身体的位置。即忽略其特定形状并在估计的身体位置上方/周围使用预制形状。如果您想做某种类似蓝屏的行为,这很可能不起作用,但它也可能有助于弥补漏洞。

It's a hard to solve issue (and one of the reasons for Microsoft's Kinect to not use visible light only and why blue/green screening is still so popular). I'd try to remove holes (you should be able to predict where the body has to be). If you've got the processing power, use different thresholds and merge the results. You could as well try to filter new separated images (e.g. add current frame to last frame and normalize the result). This way you could track shapes you're losing for one frame a lot more consistent.

A different approach: Use the detected shape/region for detecting the position of the body only. I.e. ignore its specific shape and use a premade shapre above/around the estimated body position. This most likely won't work if you'd like to do some kind of bluescreen like behaviour but it might help as well closing holes.

凉墨 2024-12-01 12:03:26

Alturos.Yolo 正是您正在寻找的东西。

Yolo 从带注释的图像中学习如何检测您正在寻找的对象。首先,您需要使用 Nuget Package Manager 安装该项目以及一组已训练的图像。在您的情况下,YOLOv2-tiny 模型应该足够了:

Install-Package Alturos.Yolo
Install-Package Alturos.YoloV2TinyVocData 

安装后,您可以像这样使用它来检测图像中的人物:

using (var yoloWrapper = new YoloWrapper("yolov2-tiny-voc.cfg", "yolov2-tiny-voc.weights", "voc.names"))
{
    var items = yoloWrapper.Detect(@"your_image.jpg");
    //if (items[0].Type == "Person") { ... }
}

items 数组将包含有关找到的所有对象的信息。您可以使用 Type 属性检查您正在查看的是否是人。

Alturos.Yolo does exactly what you are looking for.

Yolo learns from annotated images how to detect the objects you are looking for. First you need to install the project, along with a set of already trained images using the Nuget Package Manager. In your case the YOLOv2-tiny model should suffice:

Install-Package Alturos.Yolo
Install-Package Alturos.YoloV2TinyVocData 

Once installed, you can use it like this to detect a human in your image:

using (var yoloWrapper = new YoloWrapper("yolov2-tiny-voc.cfg", "yolov2-tiny-voc.weights", "voc.names"))
{
    var items = yoloWrapper.Detect(@"your_image.jpg");
    //if (items[0].Type == "Person") { ... }
}

The items array will contain information about all the objects found. You can check there if it's a human you are looking at, using the Type property.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文