Commit 2be34dfe authored by Jared Lincenberg's avatar Jared Lincenberg

Added a function to quantify the Base

parent 4133262f
import numpy as np
def getBaseWeight(transform):
freqs = np.fft.fftfreq(len(transform))
hz=[]
for i in range(0,len(freqs[:120])):
x=i * (44100/len(freqs)/2)
hz.append(x)
tf=zip(list(hz),list(transform))
tf=list(tf)
print()
t1=[t[1] for t in tf if t[0]>20 and t[0]<120]
print(sum(t1))
tfinal=int(sum(t1)*10)
return(tfinal)
\ No newline at end of file
This diff is collapsed.
import matplotlib
matplotlib.use('TkAgg')
import time
import matplotlib.pyplot as plt
import numpy as np
......@@ -15,6 +17,7 @@ import cv2
import librosaToWave
import generate_waves
import fftToImage
import ImageFunctions
load_from_file = False
file_name = None
......@@ -106,7 +109,7 @@ while t - origin < len(wav_data) / rate:
transform = np.abs(np.fft.fft(second[:]))
plot_transform = np.fft.fftshift(transform)
print(ImageFunctions.getBaseWeight(transform))
max_val = np.amax(transform)
hsv_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
h, s, v = cv2.split(hsv_frame)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment