This file contains 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
# -*- coding: utf-8 -*- | |
import numpy as np | |
import pyaudio | |
import struct | |
import time | |
__author__ = "TonyMooori" | |
class MusicMorph: | |
def __init__(self,length = 8,n_child = 4,pulse = 0.25, mutation = 0.25): |
This file contains 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
#coding:utf-8 | |
import pygame | |
from pygame.locals import * | |
import numpy as np | |
""" | |
参考: | |
ライフゲーム - 人工知能に関する断創録 | |
http://aidiary.hatenablog.com/entry/20080914/1281748797 | |
""" |
This file contains 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
#coding:utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def approx(x,x_data,y_data): | |
""" x_data,y_dataを利用してy(x)の値をラグランジュ補間で予測する """ | |
y = 0 # 予想されるf(x)の近似値 | |
n_data = len(x_data) # サンプルデータの数 |
This file contains 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
#coding:utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def approx(x,x_data,y_data): | |
""" x_data,y_dataを利用してy(x)の値をラグランジュ補間で予測する """ | |
y = 0 # 予想されるf(x)の近似値 | |
n_data = len(x_data) # サンプルデータの数 |
This file contains 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
# -*- coding: utf-8 -*- | |
import numpy as np | |
import cv2 | |
import time | |
cap = cv2.VideoCapture(0) | |
f = open("output.csv","w") | |
f.write("t,x,y\n") | |
start = time.time() |
This file contains 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
#coding:utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
# 最初のデータはWebカメラの調子が悪いため無視 | |
data = pd.read_csv("output.csv") | |
data = data[50:] | |
# 計算しやすいように取り出す |
This file contains 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
#coding: utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.datasets import fetch_mldata | |
from sklearn.cross_validation import train_test_split | |
from sklearn.metrics import confusion_matrix, classification_report | |
def corrcoef(x,y): | |
""" ベクトルx,yの相関係数を求める関数 """ | |
# ノルムが0になる場合はないものとします |
This file contains 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
#coding: utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
""" | |
参考: | |
[1]『画像処理とパターン認識入門』酒井幸市 著 | |
[2] scipy.fftpack.dct http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.fftpack.dct.html | |
""" |
This file contains 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
#coding: utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
""" | |
参考: | |
[1]『画像処理とパターン認識入門』酒井幸市 著 | |
[2] scipy.fftpack.dct http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.fftpack.dct.html | |
""" |
This file contains 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
class FourierPlotter { | |
int n_data; // データの個数 | |
int n_approx; // 近似次数 | |
float[][] radius; // 半径 | |
float[] data; // データ | |
float centerX; // 中心X座標 | |
float centerY; // 中心Y座標 | |
float phase; // 位相のズレ | |
public float x; // 先端部分のX座標 | |
public float y; // 先端部分のY座標 |
OlderNewer