Skip to content

Instantly share code, notes, and snippets.

View toshinoritakata's full-sized avatar

Toshinori Takata toshinoritakata

View GitHub Profile
@toshinoritakata
toshinoritakata / calcCameraCalibration.cpp
Last active March 4, 2024 12:25
openFrameworksとレンズゆがみ計算
#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;
@toshinoritakata
toshinoritakata / gist:4249744
Last active January 14, 2020 07:33
3桁でゼロパディング
function padding3(num) {
var res;
if (eval(num) < 999) {
res = ("00"+num).slice(-3);
} else {
res = ""+num; //文字列に変換
}
return res;
}
# http://members.chello.at/~easyfilter/bresenham.html
import math
size(420, 420)
noSmooth()
background(0)
stroke(255)
def plotLine(x0, y0, x1, y1):
@toshinoritakata
toshinoritakata / CGWORLD3_FaceDetectionWebCamTextureExampleTracked.cs
Last active December 17, 2018 15:25
連載3 顔検出 複数対応版
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;
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;
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 August 24, 2016 01:06
DOSでallディレクトリ内のpngファイルを25%縮小してiconフォルダに同名で保存する
FOR %1 in (all\*.png) DO magick -verbose %1 -resize 50% icon\%~xn1
@toshinoritakata
toshinoritakata / gist:6559815
Created September 14, 2013 08:03
Photoshopでレイヤーマスクを選択する。 レイヤーマスクを作業対象にするにはレイヤーを選択後、レイヤーマスクのチャンネルを表示して選択する必要がある
var Layer_Name = "レイヤー名";
// SELECT LAYER =======================================================
var idslct = charIDToTypeID( "slct" );
var desc227 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref170 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idChnl = charIDToTypeID( "Chnl" );
var idMsk = charIDToTypeID( "Msk " );
@toshinoritakata
toshinoritakata / gist:6546966
Created September 13, 2013 05:11
Photoshopのデータセットの読み込みと適用
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
fileImportDataSets = function(file) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( sTID( "dataSetClass" ) );
desc.putReference( cTID( "null" ), ref );
desc.putPath( cTID( "Usng" ), new File( file ) );
desc.putEnumerated( cTID( "Encd" ), sTID( "dataSetEncoding" ), sTID( "dataSetEncodingAuto" ) );
@toshinoritakata
toshinoritakata / gist:6474375
Created September 7, 2013 10:05
合成マット素材をstraightに変換して、_fillディレクトリに保存する
#include <iostream>
#include "windows.h"
#include "stdafx.h"
#include "FreeImage.h"
#include "boost/foreach.hpp"
#include "boost/filesystem/path.hpp"
#include "boost/filesystem/operations.hpp"
void MakeStraight(boost::filesystem::path in_file_path, boost::filesystem::path out_path)
{