Opencv Algorithm to detect moving vehicle in moving/shaking camera

Surinder ツ picture Surinder ツ · Feb 25, 2014 · Viewed 12.6k times · Source

Is there any way in opencv to detect moving vehicle/object when camera is moving/shaking.

I have read and implemented various Object Detection algorithms in opencv, but also they detect false areas of frame because of shaking camera.

If you have any solution please help.

Thanks.

Answer

Y.AL picture Y.AL · Feb 25, 2014

Here you have two issues to be solved,

  1. Detection
  2. Stabilization

For detection, you have few methods, but if you have various different shapes to be detected if prefer that you try the cascade classifiers., Here you can detect what you want, but you need to do training phase for your objectives (positive and negative images.). it is so simple to train you obejects. Here you find a detailed project, same as yours. Here opencv explains you how to train your images to get a classifiers.

For stabilization, I suggest you to see the algorithm of tracking.This project implements a basic realtime lane and vehicle tracking using OpenCV. . If I were you i calculate the optical flow for each pair and track them by the similarity between them. Ma be you need to see in Opencv:

  1. optical flow

  2. compute the similarity between images

  3. if you need to stabilize the shaking images you have to mix the two previous steps.

Let'us know once you need more explainantion