Ask Your Question

How to know if a camera is stationary or moving?

asked 2017-05-16 14:00:24 -0600

horizon1710 gravatar image

I would like to use a hybrid motion detection algorithm for both stationary and moving cameras. Before selecting the appropriate method for background subtraction, I need to know if camera is fixed or moving. I wish to use 2 frames (current and previous one) to figure it out but could not come up with a good solution.

I tried to search about the problem but my search attempts always brought irrelevant studies. So wanted to ask you for ideas.

Do you know any method for doing this or any idea?

Thanks in advance.

edit retag flag offensive close merge delete


try to use descriptors and match it.

LBerger gravatar imageLBerger ( 2017-05-16 14:11:24 -0600 )edit

@LBerger Yes but, even a stationary camera scene may change a lot between 2 sequential frames. How to use descriptors effectively?

horizon1710 gravatar imagehorizon1710 ( 2017-05-16 14:23:07 -0600 )edit

I think it is a statistical problem. If n% of descriptors are fixed then camera is fixed.

LBerger gravatar imageLBerger ( 2017-05-16 14:27:22 -0600 )edit

@berak When the camera is stationary and there are moving objects in scene, these approach (phase correlation) returns with motion. I only want to know if camera is moving.

horizon1710 gravatar imagehorizon1710 ( 2017-06-08 09:39:50 -0600 )edit

2 answers

Sort by » oldest newest most voted

answered 2020-05-11 22:56:48 -0600

sterkhedkar gravatar image

updated 2020-07-01 05:11:13 -0600

supra56 gravatar image

There is one simple way to detect if the camera is moving. People here have already pointed out that a solution to simply match the points in the frame would not work as even if a camera is steady, there can be a motion in that frame.

To tackle all of such possibilities, think of drawing boxes along the edges of the frame. These boxes would have width of ~5% width of the frame and run along the all vertical and horizontal edges of the frame.

Let’s name those 4 boxes: top(i), bottom(i) left(i) and right(i)

And we have two frame f1 and f2 in consideration.

While matching the two frames in consideration, we match the points only within the boxes.

i.e., match top(1) with top(2), bottom(1) with bottom(2) and so on. If all four boxes are not matching, then the camera is moving


edit flag offensive delete link more


That is good solution.

supra56 gravatar imagesupra56 ( 2020-07-01 05:12:50 -0600 )edit

answered 2017-05-16 16:37:53 -0600

Tetragramm gravatar image

There's no way to answer definitively without a system that completely understands the image and everything in it, but we can come close.

Basically, if the camera is moving, everything you see in the image is undergoing the same apparent motion plus whatever real motion those objects are taking. So your basic effort is to match points between frames, then calculate the camera motion that would cause them to align. That would be the findEssentialMat function. Then, if the motion is large, the camera is moving.

Obviously, if there are many objects moving in a consistent manner that will throw off the calculation, but depending on the application, you should be able to filter or otherwise deal with it. Many objects moving in different ways should not cause a problem, as the RANSAC or LMED methods would throw them out of consideration.

And of course, you can use time in your favor as well. If the motion changes with every frame, it might not be real, but if it's consistent, then it is real. Kalman filters are your friend for this.

It's not an easy problem, so good luck.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-05-16 14:00:24 -0600

Seen: 3,436 times

Last updated: Jul 01 '20