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
private void Window_Loaded(object sender, RoutedEventArgs e){ | |
KinectSensor kinect = KinectSensor.GetDefault(); | |
if (kinect != null){ | |
MultiSourceFrameReader multiReader = kinect.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth|FrameSourceTypes.Body); | |
multiReader.MultiSourceFrameArrived += multiReader_MultiSourceFrameArrived; | |
kinect.Open(); | |
} | |
} | |
void multiReader_MultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e){ | |
MultiSourceFrame reference = e.FrameReference.AcquireFrame(); | |
// Color | |
using (ColorFrame myColorFrame = reference.ColorFrameReference.AcquireFrame()) | |
using (DepthFrame myDepthFrame = reference.DepthFrameReference.AcquireFrame()) | |
using (BodyFrame myBodyFrame = reference.BodyFrameReference.AcquireFrame()){ | |
// ここにいろいろ書いていく | |
} |
0 件のコメント:
コメントを投稿