Math is Hard - Calc Altitude based on Onboard Images

The Rocketry Forum

Help Support The Rocketry Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

frogglicker

Well-Known Member
TRF Supporter
Joined
Feb 10, 2023
Messages
353
Reaction score
621
Location
Centennial, Colorado
Happy Sunday. I wasn't able to attend my club's launch today, so I am home reviewing some footage from my HPR Level 1 Cert flight. I wanted to get an accurate altitude at apogee. OpenRocket calculated the Hobgoblin -- that weighs 1207g with an H210 onboard -- to reach ~ 797 meters (2,614 ft). The Estes altimeter read back 4,312 ft. From experience, I suspect that the OR value is a bit high and that the Estes value is "SnoopDog" high (I am in Colorado).

However, I do have my onboard footage from the flight and was able to pick out some ground points. From the photos below, I found two points on the ground that are ~ 2,046 feet apart using Google Earth. taking the snapshot from the video, I was able to measure this distance on my monitor at 10 inches. I calculated:

h / d_actual = d_apparent / 1 unit

h / 2047 feet = (10in) or 0.833 feet or
h = 0.8333 ft * 2047 ft; thus
h = 1,705.83~ ft.

***
EDIT:
Camera Used: RunCam2 4k
FieldOfView: 120 degrees
FocalLength: 40mm
***

It has been a long time since doing something like this and I was wondering if anyone can check my method to see if this is the right way to do this and if I am missing something. 1,700' does line up closer with the OpenRocket Sim. Typically, OR is within 20% of the actual result but it was 35% high on this sim. I was pretty detailed in my calculations but there could be various anomalies not accounted for. Also, ChatGPT seems to agree with me but I wanted to check in for some validation of my method to see if this is a viable alternative to calculating altitude.

Thanks for your help.



altitude_google_earth.png


altitude_flight_camea.png
 
Last edited:
I went back and looked at the footage from flight #1. The sim estimated the apogee at 2,896' and using this same method (no pics this time), I calculated the apogee to be 2.899'. This tells me that while not as accurate as an altimeter (like the Eggtimer Quantum that didn't make it on either flight ), the onboard footage can give me a fairly accurate altitude value if this method is viable.
 
I don't quite understand what d_apparent or "1 Unit" are intended to represent in your calculation, but I'm pretty sure what you're doing is not correct as written.

Partly because as written the unit analysis doesn't work ( [thing in feet] * [other thing in feet] can't result in an answer that's in feet).

Also partly because to make something like this work you generally need to calibrate the field of view of the camera.

The way I'm used to doing these calculations is to start with a perspective calculation like:

[size of object in feet] / [distance to object in feet] = [size of object in pixels] * K

where K is a property of the camera setup you either measure or figure out by calculating from camera sensor sizes and lens properties and stuff.

You can calibrate the camera after the flight if you haven't done it before. Just take a picture with the same camera and lens setup of something else where you can measure the size and the distance. Then use those numbers to solve for K. Plug that K and the measurements from the flight images in and hopefully you get a useful altitude out.
 
Sorry, this makes no sense. How does distance on the ground give an altitude? Maybe if you used the "eye alt" parameter in Earth with your image overlay, you might be able to get close.

Better yet, ditch the Estes altimeter for a better device.
 
Sorry, this makes no sense. How does distance on the ground give an altitude? Maybe if you used the "eye alt" parameter in Earth with your image overlay, you might be able to get close.

Better yet, ditch the Estes altimeter for a better device.
This technique can definitely work. Basically it works by taking the fact that stuff looks smaller when it's farther away, and making that quantitative.
 
Your math makes no sense, as you are using it to do something that cannot be done.
Take your rocket camera out and take a picture of something big that is ~2000' away - Maybe stand on top of a cliff, or take a picture of a geologic feature. Then post it, and we can compare the photos and do the math.
 
Thanks for the replies. I started with basically OpenRocket estimates, Estes altimeter garbage readings, and onboard footage. I just wanted to see if it was doable. I did a quick search to see if there was something on the web, and ChatGPT gave me the formula. I'm just noodling around to see if there might be a way to do this. It feels like something is missing but most important, No lives are at stake!

I have an Eggtimer Quantum that has performed very well. Unfortunately, it got shwacked on the first launch, so data from the first launch was lost. I had to replace the nose cone for the 2nd flight. Thankfully, I brought my Big Red Max with me and was able to use that one, but no AV Bay.

Once I get another Eggtimer and some decent footage, I will compare the results and report back. ☮️
 
Did you set the simulation launch altitude, pressure, temperature, humidity to actual conditions?
 
I did a quick search to see if there was something on the web, and ChatGPT gave me the formula.
There is no "formula" here. A formula is a meaningful relationship between parameters. You multiplied two numbers in a nonsensical manner.


It feels like something is missing
Indeed, namely some sort of vertical distance reference.
 
Happy Sunday. I wasn't able to attend my club's launch today, so I am home reviewing some footage from my HPR Level 1 Cert flight. I wanted to get an accurate altitude at apogee. OpenRocket calculated the Hobgoblin -- that weighs 1207g with an H210 onboard -- to reach ~ 797 meters (2,614 ft). The Estes altimeter read back 4,312 ft. From experience, I suspect that the OR value is a bit high and that the Estes value is "SnoopDog" high (I am in Colorado).

However, I do have my onboard footage from the flight and was able to pick out some ground points. From the photos below, I found two points on the ground that are ~ 2,046 feet apart using Google Earth. taking the snapshot from the video, I was able to measure this distance on my monitor at 10 inches. I calculated:

h / d_actual = d_apparent / 1 unit

h / 2047 feet = (10in) or 0.833 feet or
h = 0.8333 ft * 2047 ft; thus
h = 1,705.83~ ft.

***
EDIT:
Camera Used: RunCam2 4k
FieldOfView: 120 degrees
FocalLength: 40mm
***

It has been a long time since doing something like this and I was wondering if anyone can check my method to see if this is the right way to do this and if I am missing something. 1,700' does line up closer with the OpenRocket Sim. Typically, OR is within 20% of the actual result but it was 35% high on this sim. I was pretty detailed in my calculations but there could be various anomalies not accounted for. Also, ChatGPT seems to agree with me but I wanted to check in for some validation of my method to see if this is a viable alternative to calculating altitude.

Thanks for your help.

Determining altitude from an onboard image requires knowledge of the field of view of the camera. For example:

Say that measurement post-flight shows that when the front of the camera lens is exactly 9.0 inches from a ruler, the camera image (in the horizontal plane) shows 4.2 inches of that ruler, edge to edge.

Now consider a ground image taken with the same camera: that ground image shows two known ground locations that are, say, 560 feet apart. For convenience, we will assume that this distance happens to be exactly in the horizontal plane of the image. Looking at the image on a computer we measure that 560 foot distance as being 10.0 inches on the screen, we further measure the total horizontal (side-to-side) distance on the screen as 12.6 inches.

It follows that the side-to-side length of the image is 12.6 * 560 / 10 = 705.6 feet

Assuming the camera is looking straight down, we can estimate that the distance from the ground to the camera lens is 705.6 * 9.0 / 4.2 = 1512 feet.

CAUTION: As given, this calculation assumes that the camera is directly above and parallel to the ground and requires that the measured ground distance be in the horizontal plane of the camera image.

If the measured ground distance is at some angle to the horizontal image plane of the camera, then the standard trigonometric conversions will be required to estimate the image edge-to-edge distance. Similarly, if the camera image is not taken parallel to the ground, then additional trigonometric conversions will be needed to more accurately estimate the edge-to-edge distance and to adjust for any angle between the camera and true vertical. Finally, because camera image sensors are generally rectangular, a separate measurement of the field of view in the vertical plane will be required if one chooses to calculate based on vertical rather than horizontal distances.

For slightly higher flights, the attached paper will allow a somewhat more accurate estimate.


Bill
 

Attachments

  • Altitude from Limb.pdf
    266.7 KB · Views: 1
Last edited:
Determining altitude from an onboard image requires knowledge of the field of view of the camera. For example:

Say that measurement post-flight shows that when the front of the camera lens is exactly 9.0 inches from a ruler, the camera image (in the horizontal plane) shows 4.2 inches of that ruler, edge to edge.

Now consider a ground image taken with the same camera: that ground image shows a distance between two known ground locations of, say, 560 feet. For convenience, we will assume that this distance happens to be exactly in the horizontal plane of the image. Looking at the image on a computer we measure that 560 foot distance as being 10.0 inches; we further measure the total horizontal (side-to-side) distance on the screen as 12.6 inches.

I follows that the side-to-side length of the image is 12.6 * 560 / 10 = 705.6 feet

Assuming the camera is looking straight down, we can estimate that the distance from the ground to the camera lens is 705.6 * 9.0 / 4.2 = 1512 feet.

CAUTION: As given, this calculation assumes that the camera image is directly above and parallel to the ground image and requires that the measured ground distance be in the horizontal plane of the camera image.

If the measured ground distance is at come angle to the horizontal image plane of the camera, then the standard trigonometric conversions will be required to estimate the image edge-to-edge distance. Similarly, if the camera image is not taken parallel to the ground, then additional trigonometric conversions will be needed to more accurately estimate the edge-to-edge distance and to adjust for any angle between the camera and true vertical. Finally, because camera image sensors are generally rectangular, a separate measurement of the field of view in the vertical plane will be required if one chooses to calculate based on vertical rather than horizontal distances.

For slightly higher flights, the attached paper will allow a somewhat more accurate estimate.


Bill
Thank you, Bill. I knew there was a way, but I just didn't know the method. While this started out as a thing to do (to avoid mowing the grass) on Sunday, it has become an interesting problem.

I really appreciate the time you took to explain this, and the attachment is exactly what I was looking for.
 
Bill got it correct as did others that state Camera Field of View is required.
And this assumes the Lens has no distortion. A quick check for distrotion can be done by imaging a grid (grapgh paper). If the grid looks square then disortion can be ignored.

frogglicker,
I use an Eggtimer Quark ($20) as a simple altimeter. Put 200-470 Ohm resistors on the outputs so it 'arms.
Works great as a small low cost altimeter.
 
Bill got it correct as did others that state Camera Field of View is required.
And this assumes the Lens has no distortion. A quick check for distrotion can be done by imaging a grid (grapgh paper). If the grid looks square then disortion can be ignored.

frogglicker,
I use an Eggtimer Quark ($20) as a simple altimeter. Put 200-470 Ohm resistors on the outputs so it 'arms.
Works great as a small low cost altimeter.
Thanks, Walt. I have typically flown with an Eggtimer Quantum, including my first cert attempt flight but it didn't survive the landing, hence the reason for the Estes backup. I really like the Eggtimer. It's small, inexpensive, and packs lots of features that I find convenient. I also don't mind putting them together. I'm about to order two more and maybe a quasar, too. Per your suggestion, I am going to give the Quark another look as well. If you have two, you have one. If you have one, you have none. I will probably be leaving the Estes altimeter to my son's rockets.

I also realized that when I rebuilt the top half of the Hobgoblin, I failed to include the vent holes that I had on the MK1. When it flew on its maiden launch, both the Quantum and Estes Altimeter were accurate... just over 10ft of each other.

I read through the paper that Bill attached this morning and this actually seems doable. To what end? I dunno. I guess it keeps me distracted from all the stuff going on. Rocketry has revitalized me. I feel like I have focus again, instead of being just another meat-puppet, office drone. These little thought experiments are just my way of picking up rocks to see what's underneath.

Blue skies, my friends... Blue skies.
 
Probably the most accurate is to fly the same set up with the altimeter(s) and make similar measurements.
Thanks, Ron. I was thinking the same thing. I haven't flown that rocket since the cert flight, though I have been trying for the past few weeks. The weather just won't cooperate. The sim says around 1,700 and similar rockets are in that range at that field. I guess I'll just have to go out and fly it again. shucks. 😜
 
You'll have to use something like the Ion that gives you a graph so you can estimate where the rocket is when you take the screen grab. I've been running the Ion with an Estes altimeter as back up. The filtered altitude looks nice but not very accurate when I compare it to the flight video and the raw altitude.
 
seems like a more accurate and easy solution would be to get a better altimeter. It seems like there's no way for the calculation to be done unless you have tilt and have intimate knowledge of the camera.

The good news is that it looked like a fun flight, and at least to me is the most important thing.
 
Back
Top