本文整理汇总了C#中KinectSensor.Open方法的典型用法代码示例。如果您正苦于以下问题:C# KinectSensor.Open方法的具体用法?C# KinectSensor.Open怎么用?C# KinectSensor.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KinectSensor
的用法示例。
在下文中一共展示了KinectSensor.Open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNavigatedTo
protected override void OnNavigatedTo( NavigationEventArgs e )
{
base.OnNavigatedTo( e );
try {
// Kinectを開く
kinect = KinectSensor.GetDefault();
kinect.Open();
// 表示のためのデータを作成
depthFrameDesc = kinect.DepthFrameSource.FrameDescription;
// Depthリーダーを開く
depthFrameReader = kinect.DepthFrameSource.OpenReader();
depthFrameReader.FrameArrived += depthFrameReader_FrameArrived;
// 表示のためのデータ
depthBitmap = new WriteableBitmap( depthFrameDesc.Width,
depthFrameDesc.Height );
ImageDepth.Source = depthBitmap;
depthBuffer = new ushort[depthFrameDesc.LengthInPixels];
depthBitmapBuffer = new byte[depthFrameDesc.LengthInPixels * 4];
depthPoint = new Point( depthFrameDesc.Width / 2,
depthFrameDesc.Height / 2 );
}
catch ( Exception ex ) {
MessageDialog dlg = new MessageDialog(ex.Message);
dlg.ShowAsync();
}
}
示例2: OnNavigatedTo
protected override void OnNavigatedTo( NavigationEventArgs e )
{
base.OnNavigatedTo( e );
try {
// Kinectを開く
kinect = KinectSensor.GetDefault();
if ( kinect == null ) {
throw new Exception( "Kinectを開けません" );
}
kinect.Open();
// カラー画像の情報を作成する(BGRAフォーマット)
colorFrameDesc = kinect.ColorFrameSource.CreateFrameDescription( ColorImageFormat.Bgra );
colorBitmap = new WriteableBitmap( colorFrameDesc.Width, colorFrameDesc.Height );
ImageColor.Source = colorBitmap;
colorBuffer = new byte[colorFrameDesc.Width * colorFrameDesc.Height * colorFrameDesc.BytesPerPixel];
// カラーリーダーを開く
colorFrameReader = kinect.ColorFrameSource.OpenReader();
colorFrameReader.FrameArrived += colorFrameReader_FrameArrived;
}
catch ( Exception ex ) {
MessageDialog dlg = new MessageDialog( ex.Message );
dlg.ShowAsync();
}
}
示例3: OnNavigatedTo
protected override void OnNavigatedTo( NavigationEventArgs e )
{
base.OnNavigatedTo( e );
try {
// Kinectを開く
kinect = KinectSensor.GetDefault();
if ( kinect == null ) {
throw new Exception( "Kinectを開けません" );
}
kinect.Open();
// 赤外線画像の情報を取得する
infraredFrameDesc = kinect.InfraredFrameSource.FrameDescription;
// 画像化のためのバッファを作成する
infraredBitmapBuffer = new byte[infraredFrameDesc.LengthInPixels * 4];
infraredBitmap = new WriteableBitmap(
infraredFrameDesc.Width, infraredFrameDesc.Height );
ImageInfrared.Source = infraredBitmap;
infraredBuffer = new ushort[infraredFrameDesc.LengthInPixels];
// 赤外線画像リーダーを開く
infraredFrameReader = kinect.InfraredFrameSource.OpenReader();
infraredFrameReader.FrameArrived += infraredFrameReader_FrameArrived;
}
catch ( Exception ex ) {
MessageDialog dlg = new MessageDialog( ex.Message );
dlg.ShowAsync();
}
}
示例4: MainPage
public MainPage()
{
InitializeComponent();
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_bodies = new Body[_sensor.BodyFrameSource.BodyCount];
_colorReader = _sensor.ColorFrameSource.OpenReader();
_colorReader.FrameArrived += ColorReader_FrameArrived;
_bodyReader = _sensor.BodyFrameSource.OpenReader();
_bodyReader.FrameArrived += BodyReader_FrameArrived;
// 2) Initialize the face source with the desired features
_faceSource = new FaceFrameSource(_sensor, 0, FaceFrameFeatures.BoundingBoxInColorSpace |
FaceFrameFeatures.FaceEngagement |
FaceFrameFeatures.Glasses |
FaceFrameFeatures.Happy |
FaceFrameFeatures.LeftEyeClosed |
FaceFrameFeatures.MouthOpen |
FaceFrameFeatures.PointsInColorSpace |
FaceFrameFeatures.RightEyeClosed);
_faceReader = _faceSource.OpenReader();
_faceReader.FrameArrived += FaceReader_FrameArrived;
}
}
示例5: MainPage
public MainPage()
{
InitializeComponent();
_navigationHelper = new NavigationHelper(this);
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body);
_reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;
_gestureController = new GestureController();
_gestureController.GestureRecognized += GestureController_GestureRecognized;
}
// Initialize the gesture detection objects for our gestures
this.gestureDetectorList = new List<GestureDetector>();
// Create a gesture detector for each body (6 bodies => 6 detectors)
int maxBodies = this._sensor.BodyFrameSource.BodyCount;
for (int i = 0; i < maxBodies; ++i)
{
GestureResultView result =
new GestureResultView(i, false, false, 0.0f);
GestureDetector detector =
new GestureDetector(this._sensor, result);
result.PropertyChanged += GestureResult_PropertyChanged;
this.gestureDetectorList.Add(detector);
}
}
示例6: OnNavigatedTo
protected override void OnNavigatedTo( NavigationEventArgs e )
{
base.OnNavigatedTo( e );
try {
kinect = KinectSensor.GetDefault();
kinect.Open();
}
catch ( Exception ex ) {
MessageDialog dlg = new MessageDialog(ex.Message);
dlg.ShowAsync();
}
}
示例7: Page_Loaded
private void Page_Loaded(object sender, RoutedEventArgs e)
{
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body);
_reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;
_gestureController = new GestureController(GestureType.All);
_gestureController.GestureRecognized += GestureController_GestureRecognized;
}
}
示例8: BackgroundRemovalPage
public BackgroundRemovalPage()
{
InitializeComponent();
_navigationHelper = new NavigationHelper(this);
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body | FrameSourceTypes.BodyIndex);
_reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;
}
}
示例9: OnNavigatedTo
protected override void OnNavigatedTo( NavigationEventArgs e )
{
base.OnNavigatedTo( e );
try {
// Kinectを開く
kinect = KinectSensor.GetDefault();
kinect.Open();
// 挿抜検出イベントを設定
kinect.IsAvailableChanged += kinect_IsAvailableChanged;
}
catch ( Exception ex ) {
MessageDialog dlg = new MessageDialog(ex.Message);
dlg.ShowAsync();
}
}
示例10: GesturesPage
public GesturesPage()
{
InitializeComponent();
_navigationHelper = new NavigationHelper(this);
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body);
_reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;
_gestureController = new GestureController();
_gestureController.GestureRecognized += GestureController_GestureRecognized;
}
}
示例11: OnNavigatedTo
protected override void OnNavigatedTo( NavigationEventArgs e )
{
base.OnNavigatedTo( e );
try {
kinect = KinectSensor.GetDefault();
kinect.Open();
// ボディーインデックスリーダーを開く
bodyIndexFrameReader = kinect.BodyIndexFrameSource.OpenReader();
bodyIndexFrameReader.FrameArrived += bodyIndexFrameReader_FrameArrived;
// ボディーリーダーを開く
bodyFrameReader = kinect.BodyFrameSource.OpenReader();
bodyFrameReader.FrameArrived += bodyFrameReader_FrameArrived;
// Audioリーダーを開く
audioBeamFrameReader = kinect.AudioSource.OpenReader();
audioBeamFrameReader.FrameArrived += audioBeamFrameReader_FrameArrived;
// Bodyを入れる配列を作る
bodies = new Body[kinect.BodyFrameSource.BodyCount];
// 表示のためのデータを作成
bodyIndexFrameDesc = kinect.DepthFrameSource.FrameDescription;
// ボディインデックデータ用のバッファ
bodyIndexBuffer = new byte[bodyIndexFrameDesc.LengthInPixels];
// ビットマップ
bodyIndexColorBitmap = new WriteableBitmap(
bodyIndexFrameDesc.Width, bodyIndexFrameDesc.Height );
ImageBodyIndex.Source = bodyIndexColorBitmap;
bodyIndexColorBuffer = new byte[bodyIndexFrameDesc.LengthInPixels *
bodyIndexColorBytesPerPixels];
}
catch ( Exception ex ) {
MessageDialog dlg = new MessageDialog(ex.Message);
dlg.ShowAsync();
}
}
示例12: SnapHand
public SnapHand()
{
this.InitializeComponent();
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body);
_reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;
_playersController = new PlayersController();
_playersController.BodyEntered += UserReporter_BodyEntered;
_playersController.BodyLeft += UserReporter_BodyLeft;
_playersController.Start();
}
viewer.Visualization = Visualization.Color;
}
示例13: OnNavigatedTo
protected override void OnNavigatedTo( NavigationEventArgs e )
{
base.OnNavigatedTo( e );
try {
kinect = KinectSensor.GetDefault();
kinect.Open();
// 音声バッファを作成する
audioBuffer = new byte[kinect.AudioSource.SubFrameLengthInBytes];
// 音声リーダーを開く
audioBeamFrameReader = kinect.AudioSource.OpenReader();
audioBeamFrameReader.FrameArrived += audioBeamFrameReader_FrameArrived;
}
catch ( Exception ex ) {
MessageDialog dlg = new MessageDialog(ex.Message);
dlg.ShowAsync();
}
}
示例14: CameraPage
public CameraPage()
{
InitializeComponent();
_navigationHelper = new NavigationHelper(this);
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body);
_reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;
_userReporter = new UsersController();
_userReporter.BodyEntered += UserReporter_BodyEntered;
_userReporter.BodyLeft += UserReporter_BodyLeft;
_userReporter.Start();
}
}
示例15: Start
// Use this for initialization
void Start()
{
GameObject go = GameObject.Find("TextMessage");
tm = (TextMesh)go.GetComponent("TextMesh");
tm.text = "Kinect Initialize";
go = GameObject.Find("TextMessage2");
tm2 = (TextMesh)go.GetComponent("TextMesh");
go = GameObject.Find("TextMessageFPS");
tm3 = (TextMesh)go.GetComponent("TextMesh");
kinect = KinectSensor.Default;
kinect.Open();
colorReader = kinect.ColorFrameSource.OpenReader();
if (texture == null) {
texture = new Texture2D(1920,1080, TextureFormat.BGRA32,false);
renderer.material.mainTexture = texture;
tm.text = "texture created.";
}
}