One of us wrote a python program to determine the terminal velocity of our rockets. It takes a birds eye view of the rocket, then determines how much air resistance it will have. We will then use that and the weight of the rocket in a formula to determine the terminal velocity.
The program works by taking a picture of the rocket against a blue background (a recycling bin) with a 4 cm2 piece of green paper. It then counts the blue pixels, the green pixels, and the other pixels, and uses the ratio of other pixels to green pixels to estimate the area.
import datetime,sys
from PIL import Image
im = Image.open('20190805_144327.jpg')
pix = im.load()
w,h = im.size
result = im.copy()
result_pix = result.load()
green = 0
not_blue = 0
for y in range(0,h):
for x in range(0,w):
r,g,b = pix[x,y]
if g > 100 and b < 100 and r<100:
green += 1
result_pix[x,y] = (0,255,0)
elif b < 70 or b < r:
not_blue += 1
result_pix[x,y] = (r,g,b)
else:
result_pix[x,y] = (0,0,255)
print("There were ",green," green pixels.")
print("There were ",not_blue," not blue pixels.")
print("The cross section is about ",(4.0*not_blue)/green," cm^2.")
result.save('what_it_saw.png')
.
There were 78456 green pixels.
There were 141904 not blue pixels.
The cross section is about 7.234832262669522 cm^2.
Compared to an estimate from measuring of 23mm x 2mm x 3 fins + π x 9.5mm2 = 4.2 cm2