3


我有一个 EMGU(openCV 包装器)程序,它从
相机馈送中减去背景并提取漂亮干净的斑点。
现在我需要一些东西来跟踪这些 blob 并为它们分配 ID。
有什么建议/图书馆吗?


谢谢,
西南

4

2 回答 2

4

well if you have multiple objects that you would like to track you could try a Particle Filter.

Particle filters basically "disposes" particles on the image which each have a certain weight. In each time step these weights are then updated by comparing them with the actual measured value of the object at that time. Particles with high weight will then dispose more particles in its direction (with adding a slight random part on the direction) for the next time step. After a few time steps the particles will then group around the objects measured position. That's why this method is sometimes also called Survival of the fittest method...

So this whole thing builds a circle:

Initialization  ---->      Sampling
                        >             \
                       /               >
                 Updating           Prediction
                      <                /
                       \               <
                          Association

So this provides a good method of tracking objects in a given scene. One way to do multi-object tracking would be to use this one particle filter on all the objects, which would work, but has disadvantages when you try to give IDs to the objects and also when the objects cross each other since the particle clouds might lose one object and follow another one.

To solve this you could try a Mixture-Particle-Filter (by Vermaak et al. [2003]). This one tracks each of the objects by an individual Particle filter (with of course less necessary particles).

A good paper on that can be found here: http://www.springerlink.com/content/qn4704415gx65315/ (I can also supply you with several other stuff on that if you like and if you speak German I can even give you a presentation I held about that in my university a while ago)

EDIT:

Forgot to mention: Since you try to do this in OpenCV: as far as I know there is an implementation of the Condensation algorithm (the first one where you use one particle filter on the whole image) is part of the OpenCV distribution, though it might be outdated a bit. There might be newer ways of the particle filter in OpenCV directly but if not you will find a lot of results on Google if you look for OpenCV and particle filters

Hope that helps... if not, please keep asking...

于 2011-02-05T00:20:30.600 回答
2

您可以简单地调整使用 VideoSurveillance 命名空间的 EMGU CV 示例之一:

     public partial class VideoSurveilance : Form
       {
          private static MCvFont _font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_SIMPLEX, 1.0, 1.0);
          private static Capture _cameraCapture;
          private static BlobTrackerAuto<Bgr> _tracker;
          private static IBGFGDetector<Bgr> _detector;
    
          public VideoSurveilance()
          {
             InitializeComponent();
             Run();
          }
    
          void Run()
          {
             try
             {
                _cameraCapture = new Capture();
             }
             catch (Exception e)
             {
                MessageBox.Show(e.Message);
                return;
             }
             
             _detector = new FGDetector<Bgr>(FORGROUND_DETECTOR_TYPE.FGD);
    
             _tracker = new BlobTrackerAuto<Bgr>();
    
             Application.Idle += ProcessFrame;
          }
    
          void ProcessFrame(object sender, EventArgs e)
          {
             Image<Bgr, Byte> frame = _cameraCapture.QueryFrame();
             frame._SmoothGaussian(3); //filter out noises
    
             #region use the background code book model to find the forground mask
             _detector.Update(frame);
             Image<Gray, Byte> forgroundMask = _detector.ForgroundMask;
             #endregion
    
             _tracker.Process(frame, forgroundMask);
    
             foreach (MCvBlob blob in _tracker)
             {
                frame.Draw(Rectangle.Round(blob), new Bgr(255.0, 255.0, 255.0), 2);
                frame.Draw(blob.ID.ToString(), ref _font, Point.Round(blob.Center), new Bgr(255.0, 255.0, 255.0));
             }
    
             imageBox1.Image = frame;
             imageBox2.Image = forgroundMask;
    
          }
       }
于 2011-02-05T11:27:14.477 回答