Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- from picamera import PiCamera
- from time import sleep
- import os
- import datetime
- from orbit import ISS
- location = ISS.coordinates() # Equivalent to ISS.at(timescale.now()).subpoint()
- print(location)
- dir_path = os.path.dirname(os.path.realpath(__file__))
- cam = PiCamera()
- cam.resolution = (640, 360) # max resolution
- def get_latlon():
- location = ISS.coordinates()
- cam.exif_tags['GPS.GPSLongitude'] = str(location.longitude)
- cam.exif_tags['GPS.GPSLatitude'] = str(location.latitude)
- print(str(location.latitude))
- print(location.longitude)
- index = 0
- start_time = datetime.datetime.now()
- now_time = datetime.datetime.now()
- while (now_time < start_time + datetime.timedelta(minutes=178)):
- get_latlon()
- cam.capture(dir_path+"/img_{}.jpg".format(index))
- x = Image.open(dir_path+"/img_{}.jpg".format(index))
- x = x.convert('RGB')
- brightness = 0
- for X in range(640):
- for Y in range(360):
- pixelRGB = x.getpixel((X,Y))
- R,G,B = pixelRGB
- brightness += sum([R,G,B])/3
- if brightness /(640*360) >= 50 :
- index += 1
- now_time = datetime.datetime.now()
Advertisement
Add Comment
Please, Sign In to add comment