Ask Your Question

Removing jitter/shaking effect in Haar Cascade detection bounding box

asked 2013-08-02 02:11:26 -0500

vinayverma gravatar image

I have a trained classifier for Haar, with good detection most of the times. It has few false positives but for most of the frames it detects the actual object well. The problem is that the bounding box over the actual object keeps shaking a bit (even if my object is stationary) and the size of rectangle also keeps fluctuating.

I need the bounding box to be stable and in terms size and position for some distance calculations. I tried using motion detection and fixing the position if object is stationary, but it stabilizes the false positives as well.

Are there any implementations already available to achieve this?

I am also considering 2d feature matching to stabilize the rectangle (finding the previous detection around the new detection). Would it be a good idea.

Please suggest the possible approaches. Any already existing implementation would be great.


edit retag flag offensive close merge delete


Hi Vinay, any new and efficient answers for this question?

ravipotter gravatar imageravipotter ( 2019-04-04 05:19:21 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-08-02 02:18:42 -0500

What I am doing to stabilize my detections over time is keeping track of which bounding boxes have been there before. If the overlap of two bounding boxes is larger then lets say 95% (since it moves only 2-3 pixels) I do not draw the new detection but just confirm the already existing one. This does however request you for each frame to check against a set of bounding boxes, but since I am doing postprocessing I don't mind the extra time it takes.

edit flag offensive delete link more


Thanks Steven. I also tried that. But in my case sometimes the size of bounding box also changes. So the overlapp area is keeps changing. Also, I am doing almost realtime processing but still I think keeping relevant previous detections wont hurt much.

vinayverma gravatar imagevinayverma ( 2013-08-02 03:00:01 -0500 )edit

I have applied similar approach to size as well. Now ignoring sudden size changes above than a threshold. Also, below that threshold, I am considering the largest bounding box. Working perfectly fine till now.

vinayverma gravatar imagevinayverma ( 2013-08-03 23:12:51 -0500 )edit

@steven i am facing same problem. i am developing application using opencv and face detected rectangle flicker. so i cant implement eye gazing. can you please guide me how to compare rectangle from different fps, And how to compare "overlap of two bounding boxes is larger then lets say 95%"? please elaborate this more. any clue or guide will help me lot. Thanks In advance.

Devis gravatar imageDevis ( 2014-08-25 08:09:00 -0500 )edit

The detections will never be completely smooth. Complete smoothness will only happen if you average your detections over time. And this is computational expensive. As to how to compare image rectangles. Take a look at this sketch. That should guide you into solving this!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-08-25 09:36:19 -0500 )edit

What would you guys suggest for moving objects? In the application I'm trying to develop I want to use my camera as a position sensor for a moving system. the position info will be passed to a position controller later on. The only problem here is that the position determination should be as real-time as possible (introducing delay will increase the chances of instability of the controlled system) and the fact that u got to decide if there is really some movement or it is because of the flicker. any ideas?

Jannick gravatar imageJannick ( 2016-02-11 18:21:14 -0500 )edit

Just threshold the amount of movement? The jitter will never result in larger movements than a person actually moving around ...

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-12 03:33:25 -0500 )edit

Why not use optical flow in addition to correct for jitter

inac gravatar imageinac ( 2016-06-20 22:32:31 -0500 )edit

Hi inac, how do you use optical flow to correct for jitter. I tried using optical flow to follow some keypoints and find homography and find a bounding box, but that has jitter too.

ravipotter gravatar imageravipotter ( 2019-04-04 05:16:41 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2013-08-02 02:11:26 -0500

Seen: 2,942 times

Last updated: Aug 02 '13