Anon2005

Sus

Feb 24th, 2022
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. from PIL import Image
  2. from picamera import PiCamera
  3. from time import sleep
  4. import os
  5. import datetime
  6.  
  7. from orbit import ISS
  8. location = ISS.coordinates() # Equivalent to ISS.at(timescale.now()).subpoint()
  9. print(location)
  10.  
  11. dir_path = os.path.dirname(os.path.realpath(__file__))
  12.  
  13. cam = PiCamera()
  14. cam.resolution = (640, 360)  # max resolution
  15.  
  16. def get_latlon():
  17.     location = ISS.coordinates()
  18.    
  19.     cam.exif_tags['GPS.GPSLongitude'] = str(location.longitude)
  20.     cam.exif_tags['GPS.GPSLatitude'] = str(location.latitude)
  21.     print(str(location.latitude))
  22.     print(location.longitude)
  23.  
  24. index = 0
  25. start_time = datetime.datetime.now()
  26. now_time = datetime.datetime.now()
  27.  
  28. while (now_time < start_time + datetime.timedelta(minutes=178)):
  29.     get_latlon()
  30.     cam.capture(dir_path+"/img_{}.jpg".format(index))
  31.     x = Image.open(dir_path+"/img_{}.jpg".format(index))
  32.     x = x.convert('RGB')
  33.     brightness = 0
  34.     for X in range(640):
  35.         for Y in range(360):
  36.             pixelRGB = x.getpixel((X,Y))
  37.             R,G,B = pixelRGB
  38.             brightness += sum([R,G,B])/3
  39.     if brightness /(640*360) >= 50 :
  40.         index += 1
  41.     now_time = datetime.datetime.now()
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment