Hi,
Is there a way to overlay GPS information onto a live video stream from a PI camera module. I don't want to superimpose the information in post production.
Code: Select all
#!/usr/bin/python
import serial
ser = serial.Serial('/dev/ttyUSB0',4800,timeout = None)
import picamera
import datetime as dt
with picamera.PiCamera() as camera:
camera.resolution = (1280, 720)
camera.framerate = 24
camera.start_preview()
timelatlong = ""
camera.start_recording('timestamped.h264')
start = dt.datetime.now()
while (dt.datetime.now() - start).seconds < 30:
gps = ser.readline()
if gps[1 : 6] == "GPGGA":
timelatlong = gps[7:9] + ":" + gps[9:11] + ":" + gps[11:13]
timelatlong = timelatlong + " " + gps[18:20] + "." + gps[20:22] + "." + gps[23:27] + gps[28:29]
timelatlong = timelatlong + " " + gps[30:33] + "." + gps[33:35] + "." + gps[36:40] + gps[41:42]
camera.annotate_text = timelatlong
camera.wait_recording(0.2)
camera.stop_recording()