Unity
PSEYEみたいな事ができるか?
カメラ入力→画像認識→インタラクション
とりあえずwebcamの画像を表示
WebCamTexture
http://unity3d.com/support/documentation/ScriptReference/WebCamTexture.html
そのbitmapにどうアクセスできるか調べる
WebCamTexture.GetPixel
WebCamTextureもGetPixelメソッド使える
ResizeがしたいのでWebCamTextureからTexture2Dに変換,copyしたい
Copy Paste multiple Texture2d's Into New Texture2d
http://answers.unity3d.com/questions/144240/copy-paste-multiple-texture2ds-into-new-texture2d.html
textureはピクセル情報をいじったらapplyしないといけないらしい
Texture2D.Apply
http://unity3d.com/support/documentation/ScriptReference/Texture2D.Apply.html
コピーできた!
var colors : Color[] = sourceTexture.GetPixels();
texture.Resize(sourceTexture.width, sourceTexture.height);
texture.SetPixels(colors);
texture.Apply();
renderer.material.mainTexture = texture;
Resizeは実行するとピクセル情報がリセットされる(空になる)
ダメじゃん...
TextureとTexture2Dの違いって何だ?
基底クラスと派生クラス
とりあえずグレースケールにしてみる
Shaderでできた
http://answers.unity3d.com/questions/31823/how-do-i-make-a-texture-turn-greyscael.html
直前のbitmapとの変化を調べるには?(未達成)
GLクラスが使えるかもしれない
http://yasakawa.blogspot.jp/2011/10/unitytexture2d.html
http://unity3d.com/support/documentation/ScriptReference/GL.html
プラグインでネイティブのコード叩くとか
感想
ActionScriptのBitmapDataに相当するクラスが欲しい