opencv忽略框架上的一些对象 [英] opencv Ignore some object on frame

查看:365
本文介绍了opencv忽略框架上的一些对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有网络摄像头在街上,我想跟踪每一辆汽车移动的Infront相机
i用于此背景基板
现在我只是想要的想法或方法on opencv帮助我忽略一些对象
我的意思是跟踪所有的东西在街上,忽略一个对象其人类
Iam new onvv

I have webcam on street and i want to track every car moved Infront camera i used for this background Substration now i just want idea or method on opencv help me to Ignore some object I mean track every thing in street and Ignore one object its human Iam new on opencv

我尝试它的

Ptr<BackgroundSubtractor> pMOG2;
pMOG2 = createBackgroundSubtractorMOG2();

.....到代码末尾

..... to the end of code

我使用背景Substration因为它的轨道每一个东西移动前面
任何想法为忽略人只有

i use background Substration because its track every thing move infront it any idea for ignore human only

推荐答案

如果你想忽略人物,你应该首先知道哪些物体是人物,哪些人物不是人物。或视频流),您使用人员检测器。您可以使用 HogDescriptor 来执行此操作

Usually to find people in an image (or video stream), you use a people detector. You can do it with HogDescriptor

HOGDescriptor hog;
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());




将HOG描述符应用于人检测的示例可以在opencv_source_code /samples/cpp/peopledetect.cpp

An example applying the HOG descriptor for people detection can be found at opencv_source_code/samples/cpp/peopledetect.cpp

可以在opencv_source_code / samples / gpu / hog.cpp

A GPU example applying the HOG descriptor for people detection can be found at opencv_source_code/samples/gpu/hog.cpp

然后,您可以检查您的移动物体是否为人物,并决定是否忽略它们。

You can then check if your moving objects are people or not, and decide whether ignore them or not.

由于您想要跟踪汽车,一种更简单的方法是基于一个人小于一辆汽车,或者(参考其边界框)通常人的身高大于宽度(通常为人站立或步行), 。您可以应用简单的几何约束来忽略应该是什么人。

Since you want to track cars, a simpler approach is based on the consideration that a person is smaller than a car, or that (with reference to their bounding boxes) for a person usually the height is greater than the width (usually a person is standing or walking), for a car is the other way around. You can apply simple geometric constraints to ignore what should be a person.


  • 您可以设置边界框的最大面积一个人根据你的相机分辨率和视图。让我们调用这个区域值 maxAreaPerson 然后对于每个移动对象,你得到边界框(你可能已经做了,或者使用 boundingRect ))。如果框区域小于 maxAreaPerson ,则忽略它。

  • You can set the maximum area of the bounding box of a person according to your camera resolution and view. Let's call this area value maxAreaPerson Then for every moving object you get the bounding box (you probably already do that, or just use boundingRect(...)). If the box area is smaller than maxAreaPerson, you ignore it.

,您可以定义最大宽度,高度,宽高比或它们的组合。

Instead of defining the max area, you can define the max width, height, aspect ratio, or a combination of them.

宽高比将是有用的,因为它不受对象相对于相机的距离的影响。或者,您可以在视图中定义几个区域(例如,靠近相机,远离相机,远离相机),并为每个区域定义您的约束。

Probably your objects are smaller if far from camera. Aspect ratio would be useful since it's not affected by the distance of the object with respect to the camera. Or you can define a few zones in your view (e.g. near camera, far from camera, very far from camera) and define your constraint for each zone.

这篇关于opencv忽略框架上的一些对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆