-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
71 lines (63 loc) · 2.55 KB
/
Program.cs
File metadata and controls
71 lines (63 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
namespace AzureKinectSample
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MathNet.Spatial.Euclidean;
using Microsoft.Azure.Kinect.BodyTracking;
using Microsoft.Azure.Kinect.Sensor;
using Microsoft.Psi;
using Microsoft.Psi.AzureKinect;
using Microsoft.Psi.Calibration;
using Microsoft.Psi.Imaging;
/// <summary>
/// Azure Kinect postures sample program.
/// </summary>
public class Program
{
/// <summary>
/// Main entry point.
/// </summary>
public static void Main()
{
using (var pipeline = Pipeline.Create("AzureKinectSample", DeliveryPolicy.LatestMessage))
{
// Open the store
var store = PsiStore.Open(pipeline, "Azure", $"F:\\Stores");
var bodies = store.OpenStream<List<AzureKinectBody>>("Bodies");
var color = store.OpenStream<List<AzureKinectBody>>("Color");
var depth = store.OpenStream<List<AzureKinectBody>>("Depth");
// Create the componentq
Bodies.HandsProximityDetectorConfiguration configHands = new Bodies.HandsProximityDetectorConfiguration();
configHands.IsPairToCheckGiven = false;
Bodies.HandsProximityDetector detector = new Bodies.HandsProximityDetector(pipeline, configHands);
Bodies.BodyPosturesDetectorConfiguration configPostures = new Bodies.BodyPosturesDetectorConfiguration();
Bodies.BodyPosturesDetector postures = new Bodies.BodyPosturesDetector(pipeline, configPostures);
detector.Out.Do((m, e) =>
{
foreach (var data in m)
{
foreach (var item in data.Value)
Console.WriteLine($"{data.Key} - {item}");
}
});
postures.Out.Do((m, e) =>
{
foreach (var data in m)
{
foreach (var item in data.Value)
Console.WriteLine($"{data.Key} - {item}");
}
});
bodies.Out.PipeTo(detector.In);
bodies.Out.PipeTo(postures.In);
Console.Clear();
pipeline.RunAsync();
Console.ReadLine(); // press Enter to end
}
}
}
}