Skip to content

Instantly share code, notes, and snippets.

View dyama's full-sized avatar

Daisuke YAMAGUCHI dyama

View GitHub Profile
q = np.array([
[1, 0, 0, -width/2],
[0, 1, 0, -height/2],
[0, 0, 0, focal_length],
[0, 0, -1/tx, 0]
])
_points, _colors = calc_point_cloud(image, disp, q)
points = list(_points)
colors = list(_colors)
#!/usr/bin/python
# coding: utf-8
import numpy as np
import cv2
from matplotlib import pyplot as plt
img_left = cv2.imread("l.jpg",0)
img_right = cv2.imread("r.jpg",0)
img_left = cv2.GaussianBlur(cv2.equalizeHist(img_left), (3,3), 0)
img_right = cv2.GaussianBlur(cv2.equalizeHist(img_right) ,(3,3), 0)
@dyama
dyama / markov.rb
Created August 2, 2016 06:26
Markov
#!/usr/bin/ruby
# coding: utf-8
ts = {}
as = []
(`chasen source.txt`).each_line do |line|
as.push line.split(/\t/)[0]
end
@dyama
dyama / sample.lisp
Created June 15, 2016 10:58
Indended lisp sample
; ookiihou wo kaesu max kansuu
(defun ooki (x y)
(if (> x y)
x
y))
; fibonacchi suu wo kaesu
(defun fib (n)
(if (< n 2)
n
@dyama
dyama / indended-lisp.lisp
Created June 15, 2016 10:57
Indended lisp
; ookiihou wo kaesu max kansuu
defun ooki (x y)
if (> x y)
x
y
; fibonacchi suu wo kaesu
defun fib (n)
if (< n 2)
n
@dyama
dyama / supoo.rb
Created June 15, 2016 10:47
Indent nest syntax for Lisp
$indent = 2
class Array;
def nest; self[0] end
def nest=(val); self[0]=val end
def value; self[1] end
def value=(val); self[1]=val end
def comment; self[2] end
def comment=(val); self[2]=val end
end
@dyama
dyama / md5name.sh
Created May 8, 2016 11:20
md5name
#!/bin/sh
# coding: utf-8
if [ $# -gt 0 ]; then
for file in “$@”
do
if [ -f “$file” -a -s “$file” ]; then
# Get file extention
ext=`basename “$file” | sed ‘s/^.*\.\(.*\)$/\1/gi’`;
if [ “$file” == $ext ] ; then
@dyama
dyama / lifegame-1.hsp
Created March 24, 2016 07:13
lifegame-hsp
/*
HSPによるライフゲームサンプル
参考文献:
『C言語による最新アルゴリズム辞典』奥村晴彦著/技術評論社
『人工生命の世界』服部桂/オーム社
*/
#define ScreenX 160
#define ScreenY 120
@dyama
dyama / rational.c
Last active December 17, 2015 08:28
Ratinal Test
#include <stdio.h>
#include <math.h>
/* 有理数型 */
struct Rational
{
int numer; /* 分子 */
int denom; /* 分母 */
};
typedef struct Rational Rational;
@dyama
dyama / fractal-tree.rb
Created October 28, 2015 01:11
siren sample scripts
#!/usr/bin/siren
# coding: utf-8
#
# fractal tree
#
$start_len = 100.0
def tree(cur_pt, dir, len)
nxt_pt = cur_pt + dir * len