Skip to content

Instantly share code, notes, and snippets.

@TakashiYoshinaga
Created December 2, 2019 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakashiYoshinaga/5fac3f4fdb99ecb33d77d1d85ca8962a to your computer and use it in GitHub Desktop.
Save TakashiYoshinaga/5fac3f4fdb99ecb33d77d1d85ca8962a to your computer and use it in GitHub Desktop.
Connecting Test of Azure Kinect for C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//①AzureKinectSDKの読み込み
using Microsoft.Azure.Kinect.Sensor;
namespace AzureKinectTest
{
public partial class Form1 : Form
{
//②Kinectを扱う変数
Device kinect;
public Form1()
{
InitializeComponent();
InitKinect();
}
//③Kinectの初期化(Form1コンストラクタから呼び出す)
private void InitKinect()
{
//0番目のKinectと接続
kinect = Device.Open(0);
//Kinectの各種モードを設定して動作開始(設定内容自体は今回は特に考えなくてOK)
kinect.StartCameras(new DeviceConfiguration
{
ColorFormat=ImageFormat.ColorBGRA32,
ColorResolution=ColorResolution.R720p,
DepthMode=DepthMode.NFOV_2x2Binned,
SynchronizedImagesOnly=true,
CameraFPS=FPS.FPS30
});
}
//④アプリ終了時にKinect終了
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
kinect.StopCameras();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment