This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2, numpy as np, random, math | |
# Find contour edges | |
# Find the edge that is torn | |
# use the hough line transform | |
# create a mask image where the lines and white on a black background | |
# check if the point is in a white or black region | |
# Rotate the torn edges | |
# Measure how much they overlap | |
# The rotation with the maximum overlap will be how they should align |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Takes an integer and returns a siteswap character | |
def get_char(height): | |
# If the height is under 10, return the string on the height | |
if height < 10: return str(height) | |
# If the height is over 10, return 'a' for 10, 'b' for 11, etc... | |
else: return chr(height + 87) | |
# One ball goes high and the others low | |
for num_balls in range(3,6): | |
for height in range(6): | |
siteswap = get_char(height + num_balls) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2, numpy as np, math | |
raw_image = cv2.imread('/home/stephen/Desktop/gear6.jpg') | |
bilateral_filtered_image = cv2.bilateralFilter(raw_image, 5, 175, 175) | |
# Added median blurring to improve edge detection | |
median_blurred_images = cv2.medianBlur(bilateral_filtered_image, 5) | |
edge_detected_image = cv2.Canny(median_blurred_images, 75, 200) | |
# Switched from RETR_TREE to RETR_EXTERNAL to only extract most outer contours | |
_, contours, _ = cv2.findContours(edge_detected_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) | |
contour_list = [] | |
for contour in contours: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2, numpy as np, math | |
# Parameters | |
num_dots, hw, num_bins = 10, 400, 400 | |
# Read image that has two lines in it | |
lines = np.zeros((hw,hw), np.uint8) | |
# Create a row of diagonal dots | |
space = int(hw / (num_dots+1)) | |
for i in range(num_dots): cv2.circle(lines, (space*(i+1), space*(i+1)), 0, 255, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2, numpy as np, math, random | |
# create a list for the particles | |
num_particles = 25000 | |
particles = np.zeros((num_particles,5), np.float32) | |
# x, y, angle, size | |
for i in range(particles.shape[0]): particles[i] = -234,-1234,0,0,i | |
# define parameters | |
hw = 1080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2, numpy as np | |
# Read image | |
img = cv2.imread('/home/stephen/Desktop/vids/me.png') | |
h,w,_ = img.shape | |
sf = 1 | |
img = cv2.resize(img, (int(w/sf), int(h/sf))) | |
img_pristine = img.copy() | |
# Get clicks from user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from midiutil import MIDIFile | |
#if module error, try: sudo-apt get install python-scipy | |
import cv2 | |
import numpy as np | |
from matplotlib import pyplot as plt | |
import pandas as pd | |
import scipy.signal as signal | |
#path to source data | |
data_source = '/home/stephen/Desktop/sound1/sound.csv' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2, math | |
import numpy as np | |
import pandas as pd | |
import scipy | |
from sklearn import preprocessing | |
from scipy import signal | |
import matplotlib.pyplot as plt | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2, numpy as np | |
# Click on one corner of the image, | |
# then, click on the other corner on the image. | |
# The image will be cropped and saved into the folder (see below) | |
# Press 'esc' to quit | |
# Before you begin, change the path to you own video: | |
cap = cv2.VideoCapture('/home/stephen/Desktop/track.MP4') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import cv2, os | |
import scipy | |
from scipy import signal | |
import csv | |
circle_color, line_color = (255,255,0), (0,0,255) | |
window_length, polyorder = 13, 2 | |
sd = "workout" |