Skip to content

Instantly share code, notes, and snippets.

import cv2
import numpy as np
def calculate_hull(img,sensitivity=0.25):
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
gray = np.float32(gray)
corners = cv2.goodFeaturesToTrack(gray, 100, sensitivity, 10)
corners = np.int0(corners)
hull = cv2.convexHull(corners)
return hull
@burrussmp
burrussmp / server.py
Last active April 26, 2020 19:38
A simply python server
import http.server
import socketserver
class Handler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/data': # handle any GET requests to /data
pass
elif self.path == '/annotation':# handle any GET requests to /annotation
pass
def do_POST(self): # handle general post event
@burrussmp
burrussmp / gist:7fcb0bf49c5dd8e0672afe16e733c06a
Last active March 30, 2020 06:36
Sending a csv file remotely to google drive
def sendToGoogleDrive(fileName,filePath,pathToClientSecrets="/PATH/TO/credentials.json"):
gauth = GoogleAuth()
gauth.LoadClientConfigFile(pathToClientSecrets) # <-----
drive = GoogleDrive(gauth)
folder_id = 'XXXX' // example .../folders/XXXX or ..../folders/13vovGVWKWz1KvFmBFwjxIMCT5dE-WFSx
file1 = drive.CreateFile({
'title': 'data.csv',
"mimeType": "text/csv",
@burrussmp
burrussmp / gist:09e6d7d82cd144d8939675396c5fa753
Created March 30, 2020 05:23
A simple raspberry pi class for controlling the PWM GPIO pins of the Raspberry Pi 3
import pigpio
import RPi.GPIO as GPIO
class PWM:
def __init__(self):
self.pi = pigpio.pi()
self.freq = 100
self.steering = 0
self.acceleration = 0
self.gpioPinAcceleration = 18