Skip to content

Instantly share code, notes, and snippets.

Avatar

Toshinori Takata toshinoritakata

View GitHub Profile
@toshinoritakata
toshinoritakata / calcCameraCalibration.cpp
Last active May 13, 2020
openFrameworksとレンズゆがみ計算
View calcCameraCalibration.cpp
#include "ofApp.h"
// グリッドの交点の数と一つのマスの大きさ
void ofApp::calcCameraCalibration(int width, int height, float squareSize)
{
std::vector<cv::Point4f> objp;
std::vector<cv::Point3f> corner_pts;
std::vector<std::vector<cv::Point4f> > objpoints;
std::vector<std::vector<cv::Point3f> > imgpoints;
View bresenham.py
# http://members.chello.at/~easyfilter/bresenham.html
import math
size(420, 420)
noSmooth()
background(0)
stroke(255)
def plotLine(x0, y0, x1, y1):
View CGWORLD3_FaceDetectionWebCamTextureExampleTracked.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
using UnityEngine.SceneManagement;
#endif
using OpenCVForUnity;
View gist:59158fc672cf85ff35115c352eb2ee40
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
using UnityEngine.SceneManagement;
#endif
using OpenCVForUnity;
View CGWORLD3_FaceDetectionWebCamTextureExample.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
using UnityEngine.SceneManagement;
#endif
using OpenCVForUnity;
@toshinoritakata
toshinoritakata / makeicon.bat
Last active Aug 24, 2016
DOSでallディレクトリ内のpngファイルを25%縮小してiconフォルダに同名で保存する
View makeicon.bat
FOR %1 in (all\*.png) DO magick -verbose %1 -resize 50% icon\%~xn1
@toshinoritakata
toshinoritakata / taskctrl.cs
Last active Oct 10, 2015
時間が来たらプロセスを落としてスリープに入る
View taskctrl.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TaskCtrl
{
class Program
@toshinoritakata
toshinoritakata / gist:d39cde559180461624f9
Last active Oct 8, 2015
VODをiphoneで再生できるムービーに変換
View gist:d39cde559180461624f9
ffmpeg -i VTS_01_1.VOB -b:v 1500k -r 30 -vcodec h264 -strict -2 -acodec aac -ar 44100 -f mp4 out.mp4
ffmpeg -i "concat:VTS_01_1.VOB|VTS_01_2.VOB" -b:v 1500k -r 30 -vcodec h264 -strict -2 -acodec aac -ar 44100 -f mp4 out.mp4
View gist:f0a9d4eabf9facb02871
gPhoto2をcygwinでビルドする
cygwinにpopt-devlをインストールしておく
公式サイトからgphotoとlibgphotoをダウンロード
libgphotoをビルド
sh configure
make
make install
@toshinoritakata
toshinoritakata / gist:8800627
Created Feb 4, 2014
Mentalrayのnormal画像(32bit float)を読み込む
View gist:8800627
def read_image(img_file):
with open(img_file, 'rb') as img:
(format, nll, xres, yres, verson) = unpack('>BBHHH', img.read(8))
pixels = np.zeros([yres, xres, 3]) # y,xでアクセスする
for iy in range(yres):
line = unpack('>{0}f'.format(xres*3), img.read(4*xres*3))
for lx, ix in enumerate(range(0, xres*3, 3)):
pixels[iy][lx] = line[ix:ix+3]