Based on the recent NASA's DART mission, I wrote some code to calculate the satellite's distance and relative velocity based on the the size of Dismorphos (the target asteroid) on the camera frame. The concept is simple:
- Filter input image and find edges on the region of interest
- Calculate the maximum diameter of asteroid on image using it's edges
- Use some basic geometry to calculate actual distance between camera and object based on its size on the frame
- Calculate average velocity between 2 distance calculations as:
(distance_measurement_1 - distance_measurement_2)/dt
Assumptions:
- I assume the camera of the satellite can be modeled as a pinhole camera. It's specs are described here: https://en.wikipedia.org/wiki/Double_Asteroid_Redirection_Test#Camera (focal length = 2.6208 m) and here: https://ssed.gsfc.nasa.gov/IPM/2016/abstracts/4043.pdf (pixel size 6.5 μm)
- I assume the satellite is approaching the asteroid facing its longest dimension, so that the maximum length of the asteroid is visible on the frame. After a quick checkup on Dismorphos' geometry I concluded that this assumption is mostly true.
Having calculated the maximum length of the asteroid on frame, I use the following simple geometrical principle, making use of assumptions 1 and 2:
Let's call the above (1).
Dismorphos has a maximum length of L = 177 m. The symbol l is the maximum length calculated on the frame, and multiplied by the pixel size of the frame. Finally, f is the focal length.
The video that NASA has uploaded (https://www.nasa.gov/press-release/nasa-s-dart-mission-hits-asteroid-in-first-ever-planetary-defense-test) is - as described below it - sped up by a factor of 10, except the last 6 frames which are as the spacecraft returned them. From the last 6 frames I calculated a frame rate of 1 fps, so the rest of the video has to be around 10 fps, which means that 10 frames of video correspond roughly to 10 seconds of spacecraft movement (no need to be too accurate). For efficiency reasons in my code I calculate the distance every 10 frames, so when doing (distance_measurement_1 - distance_measurement_2)/dt
, dt
has to be equal to 10 seconds, because it is the time between 10 frames. Now that the structure of the problem is set, I'll present my issue:
These are 2 output frames I picked as examples. The calculated distance and velocity are shown on the top left corner of each image. The smaller window depicts the edges of the image after filtering. I also draw the maximum length that was calculated - on the smaller window (white line) for visualization purposes.
After some helpful comments, this is my current thought process to produce the above results: Whatever diameter I calculate in my code is measured in pixels on my screen, which is 1920x1080 (pixel size 0.16 mm). However I need the diameter (in pixels) as it would be measured by DART's frame, which is 2560x2160 pixels (pixel size 6.5 μm). Let's only keep 2160 out of 2560 pixels so that the frame would be a square (so 2160x2160). The images as NASA has published them, are 1041x1041 pixels. This means that 1 pixel of the image on my screen translates to ~2.075 pixels on DART's sensor.
Applying the above: max_diameter_on_DART = max_diameter_on_screen*2.075
. This gives us the diameter in pixels as measured on DART's camera frame (or at least an estimation of it).
Pixel size on DART's frame is 6.5 μm (source: https://ssed.gsfc.nasa.gov/IPM/2016/abstracts/4043.pdf), so by doing max_diameter_on_DART*6.5*10^(-6)
, I get the maximum calculated diameter of the asteroid in physical dimensions (meters) on DART's frame. Now by applying (1) i calculate the estimated distance. After that i calculate the average velocity between 2 used frames.
I expect a result close to ~6km/s for the velocity, but the estimation is still off by ~4.5km/s. This is much better from my previous results, but still way off.
Here are 2 tables containing all the inputs and calculations to derive my results, so one can keep track of everything:
Inupts | Value |
---|---|
Focal length (f) | 2.6208 m |
Pixel size (DART frame) | 6.5 μm |
Pixel size (on my screen) | 0.16 mm |
DART original frame size (pixels) | 2560x2160 |
DART modified frame size (pixels) | 2160x2160 |
My screen's frame size (pixels) | 1041x1041 |
Pixel ratio (DART frame / my screen) | 2.075 |
Dismorphos max diameter (L) | 177 m |
Time between 2 frames used (dt) | 10 sec |
Outputs | Calculation |
---|---|
Max calculated diameter on my screen (pixels) | max_diameter_on_screen |
Max calculated diameter on DART's frame (pixels) | max_diameter_on_DART = max_diameter_on_screen * 2.075 |
Max calculated diameter on DART's frame (meters) | real_max_diameter_on_DART = max_diameter_on_DART * 6.5 * 10^(-6) |
Calculated distance (meters) | distance_measurement = L * f / real_max_diameter_on_DART |
Calculated velocity (meters / sec) | (distance_measurement_1 - distance_measurement_2) / dt |
Any ideas on what I might be doing wrong? Thank you in advance.
20cm/pixel
. Doesn't this mean that each pixel is 20cm large? I doubt that the whole image sensor in the camera is 20cm large. Its probably20microns/pixel
. This would explain the factor of 1e6. Where did you get that number20cm/pixel
?$\endgroup$