# Calculating heights from parallax effect

I'm trying to calculate the heights of birds from a plane flying at a known altitude above them using the parallax effect. They're being recorded from the plane and the head and tail end coordinates marked on each frame they appear. The equation I'm using is from here:
http://www.geog.ucsb.edu/~jeff/115a/lectures/stereoscopy_and_height_measurement.html
specifically this part:
http://www.geog.ucsb.edu/~jeff/115a/lectures/stereoscopy_and_height/displacement.jpg
h = H*(dP/(P+dP))
Which I think holds up if the object you're measuring is horizontal as well as vertical, it just produces two triangles to compare (in the case of birds at the head and the tail) instead of one. Am I right about that?

The problem is the heights I'm calculating are a about 200m above what I'd expect. The speed of the birds is also a factor but I have a way to attempt to compensate for it. That's what I'll be looking into next if this height equation isn't correct in this case.

Any insight would be welcome.

Bystander
Homework Helper
Gold Member
about 200m above what I'd expect
Which is what? Helps us help if we've got an order of magnitude for effects we're speculating on for you.

Sorry, I'm getting heights largely between about 200-250m, but I'd expect them to be between about 0-50m, so it seems like something is just systematically shifting heights up.

I'm try to fix a flaw in a program someone else made, and I think they got the height equation wrong. They used the equation h = H*(1 - (P/dP)) which I think they arrived at mixing up the heights in the initial geometry, and thinking that H / (H - h) = dP / P. The only problem is when I try to fix it I get results with birds flying over 200m up, rather than just more negative heights than I'd like which was the initial problem. I'm trying to figure out if they were wrong twice (with that equation and something else I need fix now) or I'm wrong about my equation.

Bystander
Homework Helper
Gold Member
200-250m,
expect them to be between about 0-50m
Okay, that's a problem.
I think they got the height equation wrong.
They used the equation h = H*(1 - (P/dP))
"h" = bird height, and "H" = plane height? "dP" = how much longer bird image is than length at "H?" "P" = length of bird image at "H?" Then you want "dP/P," to give you distance from plane, using the original equation, or just dP/P to get height.

"h" is the bird height, "H" is the plane height, "P" is the absolute parallax, the translation of a point on the ground between two frames, and "dP" is the bird parallax, how much the bird appears to move between frames (or specifically, the average translation of its head and tail).

Of course, the birds are also moving, but the program tries to compensate for that. Their direction (based on the head and tail having been marked) is turned into a unit vector, and their motion perpendicular to the plane (basically x part of the translation) to the airplane is multiplied by dir(y)/dir(x). The result should be approximately the forward motion of the bird without the parallax effect, so this is subtracted from the forward bird translation.

Bystander
Homework Helper
Gold Member
So you get dP for head and a second dP for tail. "P" takes care of aircraft speed. What's bird speed?

The exact equations used for bird speed are:
Code:
av_dir = av_dir/sqrt(sum(av_dir.^2));
P = Gr_int(2);
bird_side = bird_int(1) - Gr_int(1);
bird_forward = bird_side*av_dir(2)/av_dir(1);
bird_parallax = bird_int(2) - bird_forward;
height = plane_height*(bird_parallax/(P + bird_parallax));
Where Gr_int and bird_int are their translations summed over a few frames, and (1) and (2) are x and y components respectively.

Bystander
Homework Helper
Gold Member
How are you distinguishing bird speed from altitude?

I'm not sure what you mean. The images are taken from above, with the y-axis being in the airplane's line of flight. The bird movement perpendicular to the plane is assumed to be parallax free. Is that a bad assumption, could it be causing the problem?

Bystander