Tracking blobs using Emgu.CV.VideoSurveillance namespace

Ask question on using Emgu CV with C#

Tracking blobs using Emgu.CV.VideoSurveillance namespace

Postby danhigham » Fri Feb 20, 2009 10:20 am

Hi All,

Can anyone give a total beginner some pointers on tracking blobs (I am building a multi-touch table) with the VideoSurveillance namespace.

An example would be awesome..

Many Thanks
Dan
danhigham
 
Posts: 2
Joined: Fri Feb 20, 2009 10:04 am

Re: Tracking blobs using Emgu.CV.VideoSurveillance namespace

Postby canming » Sun Feb 22, 2009 9:50 pm

You will need version 1.5 for the following code:

Code: Select all
         Capture capture = new Capture();
       
         ImageViewer viewer = new ImageViewer();

         BlobTrackerAutoParam param = new BlobTrackerAutoParam();
         param.ForgroundDetector = new ForgroundDetector(Emgu.CV.CvEnum.FORGROUND_DETECTOR_TYPE.FGD);
         param.FGTrainFrames = 10;
         BlobTrackerAuto tracker = new BlobTrackerAuto(param);

         Application.Idle += new EventHandler(delegate(object sender, EventArgs e)
         {
            tracker.Process(capture.QuerySmallFrame().PyrUp());
            Image<Gray, Byte> img = tracker.GetForgroundMask();
            //viewer.Image = tracker.GetForgroundMask();

            MCvFont font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_SIMPLEX, 1.0, 1.0);
            foreach (MCvBlob blob in tracker)
            {
               img.Draw(Rectangle.Round(blob), new Gray(255.0), 2);
               img.Draw(blob.ID.ToString(), ref font, Point.Round(blob.Center), new Gray(255.0));
            }
            viewer.Image = img;
         });
         viewer.ShowDialog();
canming
Site Admin
 
Posts: 873
Joined: Thu Feb 28, 2008 4:16 pm

Re: Tracking blobs using Emgu.CV.VideoSurveillance namespace

Postby danhigham » Mon Feb 23, 2009 5:49 pm

Thanks for that, eventually I found the unit tests myself shortly after posting, doh! What kind of framerate should I expect? I am using a firewire camera on a fairly quick machine but it seems to take forever to process each frame, currently I get about 1fps!

Thanks again, Dan
danhigham
 
Posts: 2
Joined: Fri Feb 20, 2009 10:04 am

Re: Tracking blobs using Emgu.CV.VideoSurveillance namespace

Postby canming » Mon Feb 23, 2009 10:00 pm

Using my usb logitech Quick cam 9000, on an P4 3.0GHz, under 320x240 resolution, I get 8FPS.

What's your camera's resolution?
canming
Site Admin
 
Posts: 873
Joined: Thu Feb 28, 2008 4:16 pm

Re: Tracking blobs using Emgu.CV.VideoSurveillance namespace

Postby badboytr » Thu Feb 26, 2009 12:44 pm

with that performance it is impossible to use openCV blob tracking for realtime surveillance.
i have my own implemented tracking system in c# which performs @70fps for 320x240 video in amd athlon x2 dual core 5200+.
because i need to process images of 4-5 cameras in a single pc i decided to have a look at openCV, if it was performing better i'd switch to openCV.
but this example shows it is not possible to make realtime processing with openCV OR is there light algorithms inside openCV to make this faster?
badboytr
 
Posts: 1
Joined: Thu Feb 26, 2009 12:35 pm

Re: Tracking blobs using Emgu.CV.VideoSurveillance namespace

Postby canming » Fri Feb 27, 2009 8:23 pm

My camera is not a fast one (The CPU spend quite a lot of time waiting for the image to be captured from the camera).

I tried the same code with synthetic 320x240 video, on a dual-core Xeon 5150 (2.66GHz), only one-core is occupied and I got 25 FPS. This is without IPP installed. I believe with IPP installed you can get a much better frame rate.

With 4 cameras, a Quad core should be able to do the tracking at about the same frame rate. (using one thread / camera)
canming
Site Admin
 
Posts: 873
Joined: Thu Feb 28, 2008 4:16 pm

Re: Tracking blobs using Emgu.CV.VideoSurveillance namespace

Postby imtufail » Mon Jun 30, 2014 7:03 am

any one could please explain me about the following statement why it is used?
param.FGTrainFrames = 10;
and where can i get the complete details of blob detection methods and classes
imtufail
 
Posts: 8
Joined: Thu Jun 20, 2013 3:58 am


Return to C# Help

Who is online

Users browsing this forum: No registered users and 6 guests