# How the select the representative frame when detecting vehicles

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);
}

• 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!) – penelope Dec 25 '13 at 20:47