Skip to content

Instantly share code, notes, and snippets.

View toshinoritakata's full-sized avatar

Toshinori Takata toshinoritakata

View GitHub Profile
@toshinoritakata
toshinoritakata / gist:8800518
Last active August 29, 2015 13:56
pyaudioで取得した音量をOSCを使ってデータを送る。 2つのマイクをコールバック関数にIDを返すことで識別している。
#!python3
# -*- coding: utf-8 -*-
import math
import pyaudio
import time
import argparse
import struct
from pythonosc import osc_message_builder
@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)
{
@toshinoritakata
toshinoritakata / gist:4544211
Last active December 11, 2015 04:18
signedなjavaのbyteをintにキャストする方法 http://javafaq.jp/S007.html 参考
byte b = 200;
int i = b & 0xFF;
System.out.println( i ); // 200
@toshinoritakata
toshinoritakata / mixChannel
Created January 13, 2013 16:09
OpenCV4AndroidでRGBとAlpha画像を一つにまとめる
List<Mat> src = new ArrayList<Mat>();
src.add(rgb);
src.add(alpha);
MatOfInt fromTo = new MatOfInt(0,0, 1,1, 2,2, 4,3);
List<Mat> dst = new ArrayList<Mat>();
dst.add(comp);
Core.mixChannels(src, dst, fromTo);
@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;
}
@toshinoritakata
toshinoritakata / gist:3473535
Created August 26, 2012 03:20
PySideでラベルの色を指定する
bg_color = (200, 100, 100)
label.setAutoFillBackground(True)
palette = label.palette()
palette.setColor(label.backgroundRole(), QtGui.QColor(*bg_color))
label.setPalette(palette)
import os
import itertools
l4 = ['aaa', 'bbb', 'ccc']
l3 = ['kk', 'aa', 'bb', 'cc']
l2 = ['axc', 'gGGe']
l1 = ['000']
for a in itertools.product(l1, l2, l3):
print a, os.path.join(*a)
@toshinoritakata
toshinoritakata / gist:2358663
Created April 11, 2012 11:11
mentalrayでMaxのシーン情報を取得
// 構造体を用意して
struct MaxSceneData {
miBoolean IsMtlEdit;
miColor AmbientLight;
miColor GlobalLightLevel;
miBoolean ForceDoubleSided;
miScalar GammaCorrection;
miScalar NearRange;
miScalar FarRange;
miScalar PhysicalScale;