Skip to content

Instantly share code, notes, and snippets.

@TakashiYoshinaga
Last active March 1, 2023 09:33
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/b4a7e9134a26f57da3e991d46d51161a to your computer and use it in GitHub Desktop.
Save TakashiYoshinaga/b4a7e9134a26f57da3e991d46d51161a to your computer and use it in GitHub Desktop.
Initialize Bitmap for Color Image of Azure Kinect
//Kinectを扱う変数
Device kinect;
//(追加①)カラー画像のBitmap
Bitmap colorBitmap;
public Form1()
{
InitializeComponent();
InitKinect();
//(追加②)Kinectの設定情報に基づいてBitmap関連情報を初期化
InitBitmap();
}
//(追加③)Bitmap画像に関する初期設定
private void InitBitmap()
{
//カラー画像の横幅(width)と縦幅(height)を取得
int width = kinect.GetCalibration().ColorCameraCalibration.ResolutionWidth;
int height = kinect.GetCalibration().ColorCameraCalibration.ResolutionHeight;
//PictureBoxに貼り付けるBitmap画像を作成。サイズはkinectのカラー画像と同じ
colorBitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment