Skip to content

Instantly share code, notes, and snippets.

View ES-Alexander's full-sized avatar

ES-Alexander

View GitHub Profile
@ES-Alexander
ES-Alexander / mavlogparse.py
Last active April 23, 2024 09:19
A MAVLink telemetry (.tlog) file parser - similarish to mavlogdump, but (I think) nicer to use and process afterwards
#!/usr/bin/env python3
''' Mavlink telemetry (.tlog) file parser.
Operates as a generator. Allows csv output or listing useful types/fields.
'''
import json
from pathlib import Path
from fnmatch import fnmatch
from pymavlink import mavutil
@ES-Alexander
ES-Alexander / mavactive.py
Last active April 2, 2024 09:25
An example of using `RC_OVERRIDE`s for basic vehicle control with Pymavlink. Includes a variety of other convenience functions.
from builtins import object
import weakref
from time import sleep
from threading import Thread, Event, Lock
from pymavlink import mavutil
import pymavlink.dialects.v20.ardupilotmega as mavlink
class WriteLockedFile(object):
@ES-Alexander
ES-Alexander / ssa_encoder.py
Last active November 23, 2023 01:12
SubStation Alpha (SSA/ASS) embedded file encoder
#!/usr/bin/env python3
def parse(file):
''' Generates encoded characters from file byte data.
Encoding is suitable for embedded [Graphics] in SubStation Alpha files.
See here for encoding specification and other details:
http://www.tcax.org/docs/ass-specs.htm
Bytes are split into groups of 6 bits, then 33 is added to each group
@ES-Alexander
ES-Alexander / inpaint-stitching-edges.py
Last active October 1, 2021 06:44
Inpaint black regions around stitched images with a blurred effect using the image edge colours.
import cv2
image = cv2.imread('combine.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
mask = (gray == 0).astype('uint8') * 255
blurred = cv2.GaussianBlur(mask, (15,15), 10)
result = cv2.inpaint(image, blurred, 3, cv2.INPAINT_TELEA)
cv2.imshow('result', result)
print('press any key to exit')