actom
Posts: 2
Joined: Thu Apr 23, 2015 11:24 pm

Overlay

Sat Apr 25, 2015 9:39 am

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.

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Overlay

Sat Apr 25, 2015 10:19 am

Of course there's a way...

... all you need to do is conceive it, believe it, research it, and then make it happen. The Raspberry PI comes with some rudimentary 'drivers' for the camera module. All of that code is open source. All you need to do is write your own 'driver' and overlay what ever you want in your live video stream... audio effects, date-time, gps, whatever you can imagine and research.

No, I have not done this yet... in fact, I'm still waiting for my camera module to arrive... Monday I think UPS said... I'll let you know how it goes, but I'm really pumped about it!
marcus
:ugeek:

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Overlay

Sat Apr 25, 2015 11:24 am

Of course there is a way. If either of you could use Google you'd be able to find it.:
http://picamera.readthedocs.org/en/latest/recipes1.html

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Overlay

Sat Apr 25, 2015 12:32 pm

I love that answer!

:mrgreen:
marcus
:ugeek:

actom
Posts: 2
Joined: Thu Apr 23, 2015 11:24 pm

Re: Overlay

Sun Apr 26, 2015 8:09 am

Thank you for your replies.
As you might have guessed I am new to this and will try my best to make it happen.
In the meantime any help to point me in the right direction is much appreciated!

gordon77
Posts: 4992
Joined: Sun Aug 05, 2012 3:12 pm

Re: Overlay

Sun Apr 26, 2015 9:22 am

Here's a simple program to get you started, just added a GPS bit to the picamera example pointed to.
Assumes the GPS is plugged into the USB.

There are probably far better ways to format the text required.

Gordon

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()

knotty
Posts: 4
Joined: Wed Dec 27, 2017 9:14 am

Re: Overlay

Wed Dec 27, 2017 10:34 am

Hi,

I read your post with interest as I'm in the process of building a computer on onboard a rocket based on the Pi Zero W, Powerboost 1000C and BerryGPS-IMU v2. I've successfully implemented your script and I'd like to see if it can display additional information however I've no experience with Python.

Could you also display the speed, course and altitude from the NMEA sentences?

Furthermore, I'm assuming more complex, but could data from other scripts also be included in the overlay? In addition to GPS the BerryGPS-IMU v2 also has an accelerometer, gyroscope, magnetometer (compass), barometric/altitude and temperature. I've got their scripts (attached) working on the command line but I'd appreciate some help getting these integrated into the overlay.

Thanks in advance.

Regards,
Paul.
Attachments
BerryScripts.zip
(4 KiB) Downloaded 42 times

Return to “General discussion”