commit 0873ef3b4e2c710da245e8370c75844e7e8ef0da Author: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun Dec 20 21:06:03 2020 -0500 Software is pretty crippled but it works somehwat! diff --git a/__pycache__/sstv.cpython-37.pyc b/__pycache__/sstv.cpython-37.pyc new file mode 100644 index 0000000..893c97c Binary files /dev/null and b/__pycache__/sstv.cpython-37.pyc differ diff --git a/photos/TEST_PATTERN.jpg b/photos/TEST_PATTERN.jpg new file mode 100644 index 0000000..432f18e Binary files /dev/null and b/photos/TEST_PATTERN.jpg differ diff --git a/photos/TEST_PATTERN.jpg.kra b/photos/TEST_PATTERN.jpg.kra new file mode 100644 index 0000000..7028117 Binary files /dev/null and b/photos/TEST_PATTERN.jpg.kra differ diff --git a/photos/camera_latest.jpg b/photos/camera_latest.jpg new file mode 100644 index 0000000..7ffc30e Binary files /dev/null and b/photos/camera_latest.jpg differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ce26a52 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +PySSTV==0.4.3 \ No newline at end of file diff --git a/sstv.py b/sstv.py new file mode 100644 index 0000000..7069226 --- /dev/null +++ b/sstv.py @@ -0,0 +1,54 @@ +from shutil import copyfile +from PIL import Image, ImageFont, ImageDraw +from pysstv import color + +def take_photo(): + # This def is meant to take a photograph from the robot, + # it should include all steps and error checking to raise the mast + # Take the photo, and put the mast down. + + # Copy in the test pattern png (if photo process errors out, this will be used instead) + copyfile('photos/TEST_PATTERN.jpg', 'working/working.jpg') + + # Software to take the photo should be here + copyfile('photos/camera_latest.jpg', 'working/working.jpg') + +def mark_photo(): + raw_img = Image.open("working/working.jpg") # Open the current working image + img = raw_img.resize((320, 240), Image.ANTIALIAS) # resize it for the radio + + + TINT_COLOR = (255, 255, 255) # White text bg + TRANSPARENCY = .25 # Degree of transparency, 0-100% + OPACITY = int(255 * TRANSPARENCY) + overlay = Image.new('RGBA', img.size, TINT_COLOR+(0,)) + + draw = ImageDraw.Draw(overlay) + bigfont = ImageFont.truetype(r'C:\Users\System-Pc\Desktop\arial.ttf', 20) + smallfont = ImageFont.truetype(r'C:\Users\System-Pc\Desktop\arial.ttf', 17) + + draw.rectangle(((0, 0), (90, 20)), fill=TINT_COLOR+(OPACITY,)) + draw.text((0, 0),"KW1FOX",(0,0,0),font=bigfont) # Draw KW1FOX in the top left + + draw.rectangle(((0, 40), (83, 100)), fill=TINT_COLOR+(OPACITY,)) + draw.text((0, 40),"day: 25.2",(0,0,0),font=smallfont) + draw.text((0, 60),"Volt: 13.8",(0,0,0),font=smallfont) + draw.text((0, 80),"Miles: 1.02",(0,0,0),font=smallfont) + + img = img.convert("RGBA") + img = Image.alpha_composite(img, overlay) + img = img.convert("RGB") + img.save('working/working.jpg') # Save the working image + return img + +if __name__ == "__main__": + # Take photograph. + take_photo() # Saves a photograph to the working/working.jpg location + + # Draw neccicary text on photo + radio_photo = mark_photo() # draws text on working/working.jpg and returns a PIL image + + slowscan = color.Robot36(radio_photo, 48000, 16) # Image, rate, bits + slowscan.write_wav('working/working.wav') + + #sstv('working/working.png', 'working/radio.wav', mode='Robot36') diff --git a/working/working.jpg b/working/working.jpg new file mode 100644 index 0000000..3e6a73d Binary files /dev/null and b/working/working.jpg differ diff --git a/working/working.wav b/working/working.wav new file mode 100644 index 0000000..8fcbb77 Binary files /dev/null and b/working/working.wav differ