Calculating motion of Spacecraft/Camera

asked 2020-10-08 21:42:16 -0500

je2 gravatar image

updated 2020-10-09 13:51:57 -0500

supra56 gravatar image

Use case:

Assume a spacecraft observing the Earth travels along its orbit fast enough such that the motion of the objects being observed (clouds, land, etc) are negligible.

Consider the following Earth observation frames captured by a spacecraft along its orbit.

Frame 1

C:\fakepath\0001.png

Frame 2

C:\fakepath\0002.png

Frame 3

C:\fakepath\0003.png

Goal:

Using only two frames, determine the direction of motion of the spacecraft/camera.

Thought process:

My thought process was to use optical flow to determine the motion of various points between the frames.

I'd then average up all the individual vectors to determine the direction of motion. Presently, I'm just doing this by adding up all the normalized vectors and hoping that with a sufficiently large number of points, the resulting vector will be within a tolerable range of error.

I've adapted the sample application, lkdemo.cpp (v3.4.9), to just accept two inputs for frames (prev and next) and output the prev image with the original points and lines pointing towards where those points would be in next.

Refer to lkdemo.cpp here: https://github.com/opencv/opencv/blob...

The arguments to goodFeaturesToTrack, cornerSubPix, and calcOpticalFlowPyrLK were not changed.

This looks OK for adjacent frames:

Frame 1 -> Frame 2

C:\fakepath\step1.1.png

Frame 2 -> Frame 3

C:\fakepath\step1.2.png

However, in some cases (e.g, skipping a frame), the result doesn't look so good.

Frame 1 -> Frame 3

C:\fakepath\step2.png

Calculating an average direction in a case like this usually leads to something very wrong.

Question

  1. Any advice for improving the result in cases like Frame 1 -> Frame 3?

  2. Any input on the overall approach for this particular use case? I'm new to OpenCV and image processing in general.

Thanks.

edit retag flag offensive close merge delete

Comments

@supra56 in my opinion generally leaving image links as is will be better (especially big files). we don't need to see images in the question all time. @berak, @LBerger what is your opinions?

sturkmen gravatar imagesturkmen ( 2020-10-09 04:47:00 -0500 )edit

The number of pyramid levels may be insufficient for the distances required going from image 1 to image 3. You might also "seed" you guess for 1-3 with the results from 1-2. Or even extrapolated them assuming constant velocity.

Der Luftmensch gravatar imageDer Luftmensch ( 2020-10-09 09:43:28 -0500 )edit