Skip to content

Instantly share code, notes, and snippets.

@kaorun55
kaorun55 / KinectSensor.h
Created October 4, 2012 03:55
Kinect for Windows SDKのFaceTakingで取得した3Dモデルを表示する(C++)
// Thaks : http://www.codeproject.com/Articles/394975/How-To-Use-Kinect-Face-Tracking-SDK
#pragma once
// NuiApi.hの前にWindows.hをインクルードする
#include <Windows.h>
#include <NuiApi.h>
#include <FaceTrackLib.h>
#include <iostream>
#include <sstream>
@kaorun55
kaorun55 / sample.re
Created October 5, 2012 03:29
ReVIEW Sample
= はじめてのReVIEW
//lead{
「Hello, ReVIEW.」
//}
== ReVIEWとは
@<b>{ReVIEW}は、EWBやRDあるいはWikiに似た簡易フォーマットで記述したテキストファイルを、目的に応じて各種の形式に変換するツールセットです。
@kaorun55
kaorun55 / MainWindow.xaml
Created October 18, 2012 08:00
training08
<Window x:Class="training08.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
Loaded="Window_Loaded" Closing="Window_Closing">
<Grid>
<Image Name="rgbImage" />
<TextBlock Name="textBlockStatus" Width="200" Height="50" HorizontalAlignment="Left" VerticalAlignment="Top" />
</Grid>
</Window>
Initialize engine version: 5.0.0b13 (5b8e776198f7)
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.0]
Renderer: Intel(R) HD Graphics 4000 (ID=0x166)
Vendor: Intel
VRAM: 128 MB
Begin MonoManager ReloadAssembly
Platform assembly: C:\Users\kaorun55\Downloads\Dragoon_full_res_Data\Managed\UnityEngine.dll (this message is harmless)
Loading C:\Users\kaorun55\Downloads\Dragoon_full_res_Data\Managed\UnityEngine.dll into Unity Child Domain
using UnityEngine;
using System.Collections;
using System;
using System.Runtime.InteropServices;
public class BorderlessWindow : MonoBehaviour {
public string WindowName = "Unityアプリのウィンドウ名";
public int X = 0;
public int Y = 0;
using System;
using System.IO;
using System.Reflection;
namespace Rename
{
class Program
{
static void Main( string[] args )
{
using UnityEngine;
using System.Collections;
using RSUnityToolkit;
public class FaceMove : MonoBehaviour
{
public SkinnedMeshRenderer MTH_DEF;
public SkinnedMeshRenderer EYE_DEF;
public SkinnedMeshRenderer EL_DEF;
Mesh ReadPly(string path)
{
Mesh mesh = new Mesh();
using ( var reader = new StreamReader(path) ) {
var line = reader.ReadLine();
if ( line != "ply" ) {
return null;
}
line = reader.ReadLine();
private Vector3 GetVector3FromJoint(Kinect.Joint joint)
{
var valid = joint.TrackingState != Kinect.TrackingState.NotTracked;
if ( Camera != null || valid ) {
// KinectのCamera座標系(3次元)をColor座標系(2次元)に変換する
var point =_CoordinateMapper.MapCameraPointToColorSpace( joint.Position );
var point2 = new Vector3( point.X, point.Y, 0 );
if ( (0<= point2.x) && (point2.x < SensorWidth) && (0 <= point2.y) && (point2.y < SensorHeight) ) {
// スクリーンサイズで調整(Kinect->Unity)
using System.Collections.Generic;
public class SimpleMovingAverage
{
private Queue<float> queue;
private int capacity;
private float sum = 0;
public void Initialize( int capacity )
{