# Calculate launch angle of object moving away from view

I'm writing image processing software and my goal here is to take an image of a projectile moving away from the camera and determine the launch angle. What I already know is:

• The actual size of the object
• The distance from the camera to point a
• The distance from point a to point b
• The speed of the projectile
• The elapsed time between points
• The height from the camera to the ground
• All technical specs of the camera

Is it possible to calculate this angle? I realize that if point a to point b is the hypotenuse then I could make the calculation if I had either the opposite or the adjacent but I'm struggling to find those measurements.

I'm not trying to model the flight path here. I need to determine the angle the object left the ground very soon (milliseconds) after launch. This angle will then feed into my flight model.

• Commented Nov 7, 2018 at 16:27
• Do you not need to model the camera too? Do you have timestamps in the images? Do you know the gravitational field? Is it obstacle free? Does the ball have rockets or is it magnetic or neither? Is it fired in a fluid, gas or vacuum?
– Emil
Commented Nov 7, 2018 at 16:38

The vertical speed at the instance of launch can be calculated by measuring how high the object reaches, that's simply:

height = v^2 sin^2(theta) / 2g

Where v is the initial velocity theta is the angle you're looking for. g is a constant. So that leaves you with three unknowns, and you're going to have to supply two.

You can measure the maximum height through the camera, but the angle of view means that it changes with distance from the camera. Think about a camera aimed at the horizon - if you stand in front of it you take up "this" much of the screen, but as you move away the angle gets less and less.

So to measure the height, you'll need to know the distance of the object into the screen. You might be able to do that if you know the original size of the object.

The horizontal component could be measured using the same size/distance relationship and comparing across several frames. For small trajectories, like a ball across the room, this will be linear enough for reasonable estimates, but it will not work for anything where drag is a real concern.

So if the ball is a known size, take many images of it at difference distances to calibrate your images. Then fire it and find the point where it reaches the maximum altitude. Use that time and the measured distance to calculate the horizontal velocity, the formula above for the vertical, and solve for theta.

• I've updated the question for further clarity. I know the original size of the object and the distance to the camera. That is how I calculated the distance between the two objects. I'm not concerned about drag as I would measure before it has any significant effect. I'm not understanding how I would get the objects height without knowing the angle first? Commented Nov 7, 2018 at 21:55
• Calibrate the camera with a yardstick (orYou simply watch the object through its trajectory and pick out the moment when it reaches it's maximum point. The only problem is that it approaches this point asymptotically, so picking out the actual maximum is difficult. Instead, look for symmetry in the vertical movement and average that to find the maximum. I am assuming the camera is looking horizontally, that is how I understand your diagram. Commented Nov 8, 2018 at 15:27

From the apparent size of the ball on the image, you should be able to calculate its distance $$d$$ to the camera. From the position on the screen, you should be able to calculate the angle $$\alpha$$ of the line to the camera with the vertical. As seen from the side:

The top picture is just to show which letters are used for the distances/angles. The bottom shows the ball for two successive video frames 0 and 1. Determine the $$d_0$$ and $$\alpha_0$$ for the first frame, and $$d_1$$ and $$\alpha_1$$ from second frame.

The angle $$\beta$$ you seek, can be computed as:

$$\tan \beta = \frac{\Delta h}{\Delta L} = \frac{h_0 - h_1}{L_1 - L_0}$$ where $$h_i = d_i \cos \alpha_i \\ L_i = d_i \sin \alpha_i$$ The speed $$v$$ will be equal to $$v = \frac{\sqrt{\Delta h^2 + \Delta L^2}}{\Delta t}$$ with $$\Delta t$$ the time between the two frames.

The accuracy will not be great, though, especially the apparent size, and therefore $$d$$ will be hard to get right. You'll have to deal with motion blur, and rolling shutter distortion. To improve the accuracy, take two frames that are further apart.

Of course, if the ball doesn't go straight up, you'll have to do this in 3D. And if the projectile is not a ball, then you'll have to deal with tumbling as well...