Last active
December 5, 2019 02:46
-
-
Save TakashiYoshinaga/cea9f9a493fcea80dcef4fee57ecf577 to your computer and use it in GitHub Desktop.
Image Transformation for Azure Kinect (Declaration of variables and methods)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace AzureKinectTest | |
{ | |
public partial class Form1 : Form | |
{ | |
//Kinectを扱う変数 | |
Device kinect; | |
//(追加3)カラー/Depth画像をBitmapとして扱う変数 | |
Bitmap colorBitmap; | |
Bitmap depthBitmap; | |
//追加4)各画像間の位置合わせ変換 | |
Transformation transformation; | |
//(追加5)Kinectからのデータ取得を継続するフラグ | |
bool loop = true; | |
public Form1() | |
{ | |
InitializeComponent(); | |
InitKinect(); | |
//(追加10)画像の初期化後、Kinectからのデータ取得開始 | |
InitBitmap(); | |
Task t = KinectLoop(); | |
} | |
//(追加6)Bitmap画像に関する初期設定 | |
private void InitBitmap() | |
{ | |
} | |
//(追加7)Kinectからデータを取得して表示するメソッド | |
private async Task KinectLoop() | |
{ | |
} | |
//(追加8)BitmapにKinectのカラー情報を書き込む | |
private void SetColorBitmap(Capture capture) | |
{ | |
} | |
//(追加9)BitmapにKinectのDepth情報を書き込む | |
private void SetDepthBitmap(Capture capture) | |
{ | |
} | |
//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