Using BlobTrackerAuto to track people in a computer vision application

I'm currently trying to develop a system that tracks people in a queue using EmguCV (OpenCV Wrapper). I started by running and overriding the VideoSurveilance example, which I downloaded into the Emgu package. Here is my code based on an example:

    private static void processVideo(string fileName)
    {
        Capture capture = new Capture(fileName);
        MCvFont font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_SIMPLEX, 
            1.0, 1.0);
        BlobTrackerAuto<Bgr> tracker = new BlobTrackerAuto<Bgr>();

        //I'm using a class that I implemented for foreground segmentation
        MyForegroundExtractor fgExtractor = new MyForegroundExtractor();

        Image<Bgr, Byte> frame = vVideo.QueryFrame();
        fgExtractor.initialize(frame);

        while (frame != null)
        {
            Image<Gray, Byte> foreground = fgExtractor.getForegroundImg(frame);
            tracker.Process(frame, foreground);

            foreach (MCvBlob blob in tracker)
            {
                if (isPersonSize(blob))
                {
                    frame.Draw((Rectangle)blob, new Bgr(0, 0, 255), 3);
                    frame.Draw(blob.ID.ToString(), ref font, 
                        Point.Round(blob.Center), new Bgr(255.0, 255.0, 255.0));
                }
            }
            CvInvoke.cvShowImage("window", frame);
            CvInvoke.cvWaitKey(1);

            frame = capture.QueryFrame();
        }
    }

AVI- . , IBGFGDetector<Bgr>, VideoSurveilance, , Emgu, CvInvoke.cvRunningAvg(), CvInvoke.cvAbsDiff(), CvInvoke.cvThreshold() cvErode/cvDilate(). :

  • , . blobs, , , .
  • "" : , /, , .
  • , , blob , ( isPersonSize()) , . , ?
  • . , ? , , , , , , tracker.GetBlobByID()?
  • , , . - if 3 :

    if (i % 3 == 0)
        tracker.Process(frame, foreground);
    

if, . , , .

, , -, OpenCV/EmguCV, , , , BlobTrackerAuto, . , , EmguCV.

+3

All Articles