1 | initial version |
You need to know the field of view (FOV) of the camera; the rest is simple.
Let's say, the vertical FOV is 40° and the horizontal and vertical resolution is 200px. That means an angular resolution of 5 pixels/degree.
The object is at (X=100,Y=110) pixels in moment T, that means 2° below the center. You move the camera 3° downwards in moment T+1, and the object is at (100,105) (1° below the center). That means, you have to draw a line from (100,105) (actual position) to (100,95) (the old position + the 3°movement).
The easiest way to implement this is to add at each iteration the position of the object to a vector, then change every element in the vector by the movement of the camera X angular resolution. Then draw the polyline over the image.