Skip to content

Instantly share code, notes, and snippets.

View kscottz's full-sized avatar
💭
🐀 🐀 🐀 🐀 🐀 🐀

Katherine Scott kscottz

💭
🐀 🐀 🐀 🐀 🐀 🐀
View GitHub Profile
@kscottz
kscottz / dewarp.py
Created August 11, 2013 20:03
Dewarping 360 degree video using python.
from SimpleCV import Camera, VideoStream, Color, Display, Image, VirtualCamera
import cv2
import numpy as np
import time
# build the mapping
def buildMap(Ws,Hs,Wd,Hd,R1,R2,Cx,Cy):
map_x = np.zeros((Hd,Wd),np.float32)
map_y = np.zeros((Hd,Wd),np.float32)
for y in range(0,int(Hd-1)):
@kscottz
kscottz / opencv_twitch.py
Created February 8, 2016 05:00
A hack to slurp up twitch streams and process them with opencv.
import cv2
import numpy as np
import time
import livestreamer
# use live streamer to figure out the stream info
streams = livestreamer.streams("http://www.twitch.tv/inostupid")
stream = streams['best']
# open our out file.
fname = "test.mpg"
@kscottz
kscottz / mp32np.py
Created July 1, 2013 04:29
Convert mp3 to numpy array. Ugly, but it works.
import os
import scipy.io.wavfile as wav
# install lame
# install bleeding edge scipy (needs new cython)
fname = 'XC135672-Red-winged\ Blackbird1301.mp3'
oname = 'temp.wav'
cmd = 'lame --decode {0} {1}'.format( fname,oname )
os.system(cmd)
data = wav.read(oname)
# your code goes here
@kscottz
kscottz / DeMagicEye.py
Created July 10, 2013 05:21
Generate a depth map from a "Magic Eye" random dot autostereogram.
from SimpleCV import Image, Display, Color
from multiprocessing import Process, Queue
import numpy as np
import cv2
import copy
import sys
# caclulate the value of a row
# using the integral image
def idxToSum(x1,x2,y,integral):
# assume x2 > x1