问题描述:

I am trying to understand blobtrack.cpp code provided as a sample code with OpenCV. In this code class named CvBlobTrackerAuto is used. I tried to find some documentation about this class but it does not provide a detailed explanation.

I am particularly interested in

CvBlobTrackerAuto::Process(IplImage *pImg, IplImage *pMask = NULL) function. What does this do and what is the task of this mask used here?

Thank you in advance

网友答案:

I've been working with CvBlobTrackerAuto in the last few weeks. Here are some of things I have figured out.

CvBlobTrackerAuto::Process is used to process the last captured image in order to update the tracking information (blob ids and positions). Actually, CvBlobTrackerAuto is an abstract class since it doesn't provide an implementation for CvBlobTrackerAuto::Process. The only concrete implementation there is (as far as I can tell) is CvBlobTrackerAuto1, which can be found in blobtrackingauto.cpp.

What CvBlobTrackerAuto1::Process does is to implement the following pipeline:

  • Foreground detection: this produces a binary mask corresponding to the foreground.
  • Blob tracking: updates the position of blobs. It may use mean shift, particle filters or a combination of these.
  • Post processing: (I'm not sure of what this section does).
  • Blob deletion: it is "experimental and simple" according to a comment in there. It deletes blobs which have been too small or near the image borders in the last frames.
  • Blob detection: detects new blobs. See enteringblobdetection.cpp.
  • Trajectory generation: (not sure of what it does).
  • Track analysis: (not sure of what it does. But I do remember having read the code and deciding that it had no influence on blob tracking, so I disabled it.)

In this particular implementation of CvBlobTrackerAuto::Process, the pMask parameter is used for nothing at all. It has a default value of NULL and it is assigned to a variable once, only to be overwritten some lines later.

The OpenCv sample to be found in samples/c/blobtrack_sample.cpp is built around this CvBlobTrackerAuto1 class, providing different options to each module in the pipeline.

I hope it helps.

网友答案:

I was directed to this link when I posted the same question in OpenCV mailing group. This doc explains OpenCV Blobtracker and its modules. Hope this helps anyone interested.

相关阅读:
Top