0

I want to find all moving objects at video. Right now, I find a foreground mask using background subtraction, then I find contours on that mask and then draw rectangles around contours.

But there is possible situation when some interesting object moves to the border on frame and I want to rotate camera to keep it in center. In that case the background moves faster than object and tracker starts tracking large background objects instead of moving object.

For i.e. we tracking ball in the football game (and there also can be a bold heads :) ) and camera rotates when ball moves to another half of field.

Is it possible to compensate the camera movement to prevent moving object tracking fail?

Is there better way to detect all moving objects on video from moving camera?

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
Robotex
  • 1,064
  • 6
  • 17
  • 41
  • you need an object *detector*, not just background subtraction. background subtraction assumes a static background, i.e. the whole picture does not move. – Christoph Rackwitz Jul 12 '22 at 16:19
  • I tried detectors from opencv distrib but it also detects background objects. – Robotex Jul 12 '22 at 16:47
  • oh, you want to detect some objects, but not others? how do they differ? can you name these objects? what object categories do you need to distinguish? are any of these object categories military in some way? – Christoph Rackwitz Jul 12 '22 at 17:12
  • @ChristophRackwitz I will use neural network for objects classification – Robotex Jul 13 '22 at 01:15

1 Answers1

0

If you know precisely by how much the background has moved, you can compensate by shifting one of the images before subtraction.

Anyway, this will not work perfectly because the transformation is not a pure shift, some deformation is added. If you have a model of lens distortion, you can compensate, but this is a relatively sophisticated operation.

Last but not least, if the camera does not rotate around its optical axis or translates, you can't exactly correct the distortion, which depends on (unknown) depth.

  • "you can compensate by shifting one of the images before subtraction" - How to do it? Is there any example? I have a video stream, so, I can make some calculations between neighbor frames. – Robotex Jul 12 '22 at 12:51
  • "Last but not least, if the camera does not rotate around its optical axis or translates, you can't exactly correct the distortion" - What do you mean? Actually, I don't need to correct distortion, just draw a frame around all objects that moving except moving background. – Robotex Jul 12 '22 at 12:53
  • @Robotex: don't correct the distortion if you prefer to ignore it. –  Jul 12 '22 at 13:27