1
$\begingroup$

I am detecting vehicles from the video (taken with a camera), and the vehicle detection part works fine.

My problem is that I should always extract only one representative frame per vehicle, and not the whole sequence.

As an example, if I have a few seconds of video (and possibly multiple vehicles), my approach currently extracts multiple frames (for every vehicle). Instead, as an output I would like one representative frame in which the vehicle is whole, i.e. well visible.

I have already implemented an entropy technique on it which makes it better but am still getting too much frames of the same vehicle. Could you suggest a technique which I can use to extract only one frame which contains the whole vehicle and ignore all other frames which contain that (same) vehicle.

I use the following entropy technique in my problem

double entropy = 0.0;
for (int i=0; i<histNorm.rows; i++)
{
    float binEntry = histNorm.at<float>(i,0);
    if (binEntry != 0.0)
        entropy -= binEntry * log2(binEntry);
}
$\endgroup$
1
  • 1
    $\begingroup$ Hey! I hope I didn't change the meaning of your question with my edit. I was trying to make your question clearer and more understandable. Please edit it back if I misunderstood something. Also, it wouldn't hurt to add a link, or a short explanation, or at least a full name of the entropy technique which you already tried. Hope you get help! (and happy holidays!) $\endgroup$
    – penelope
    Dec 25, 2013 at 20:47

1 Answer 1

2
$\begingroup$

I can not give you a full approach, but I might have an interesting suggestion. As soon as you detect a vehicle, start tracking it.

For every detection, you could "remember" the first and last frame of the video where you tracked that vehicle. You associate every vehicle detection with a series of consecutive frames. The beginning frame would be the one when the detection was made, and the ending would be the first frame when the tracking algorithm fails.

Then, you could select only a single frame for every distinct vehicle you tracked during your video sequence, with more or less simple approaches:

  • select the middle frame of the tracking sequence, as there is a high chance that in the middle of the tracking, the vehicle was well visible
  • do matching between several points in the sequence, or just base your decision on the number of features you can still track at a certain frame: selecting a frame with a large number of trackable/matchable features is probably a good choice
  • remember the "quality" of your detection for every frame in the sequence, and select the frame where the detection quality was the best
  • depending on the preferences, be mindful to either select one representative frame if the sequences for two vehicles overlap, or purposefully select different frames (possibly from non-overlapping parts of the sequences).
$\endgroup$
2
  • $\begingroup$ i was just thinking about the same technique but the only problem i was thinking in this technique was your last point , if in one frame we get two different vehicles than how we know the last frame of 1st vehicle which we are tracking $\endgroup$
    – ARG
    Dec 27, 2013 at 7:47
  • $\begingroup$ We can put a condition on overlaping frame that if overlaping occur than it should select the frame before overlaping frame as the last frame , but the problem is how we know the frame is overlaping frame $\endgroup$
    – ARG
    Dec 27, 2013 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.