MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / MainWindow

Method MainWindow

Samples/UserTracker.net/MainWindow.cs:36–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 public partial class MainWindow : Form
35 {
36 public MainWindow()
37 {
38 InitializeComponent();
39
40 this.context = Context.CreateFromXmlFile(SAMPLE_XML_FILE, out scriptNode);
41 this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
42 if (this.depth == null)
43 {
44 throw new Exception("Viewer must have a depth node!");
45 }
46
47 this.userGenerator = new UserGenerator(this.context);
48 this.skeletonCapbility = this.userGenerator.SkeletonCapability;
49 this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability;
50 this.calibPose = this.skeletonCapbility.CalibrationPose;
51
52 this.userGenerator.NewUser += userGenerator_NewUser;
53 this.userGenerator.LostUser += userGenerator_LostUser;
54 this.poseDetectionCapability.PoseDetected += poseDetectionCapability_PoseDetected;
55 this.skeletonCapbility.CalibrationComplete += skeletonCapbility_CalibrationComplete;
56
57 this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.All);
58 this.joints = new Dictionary<int,Dictionary<SkeletonJoint,SkeletonJointPosition>>();
59 this.userGenerator.StartGenerating();
60
61
62 this.histogram = new int[this.depth.DeviceMaxDepth];
63
64 MapOutputMode mapMode = this.depth.MapOutputMode;
65
66 this.bitmap = new Bitmap((int)mapMode.XRes, (int)mapMode.YRes/*, System.Drawing.Imaging.PixelFormat.Format24bppRgb*/);
67 this.shouldRun = true;
68 this.readerThread = new Thread(ReaderThread);
69 this.readerThread.Start();
70 }
71
72 void skeletonCapbility_CalibrationComplete(object sender, CalibrationProgressEventArgs e)
73 {

Callers

nothing calls this directly

Calls 4

CreateFromXmlFileMethod · 0.80
FindExistingNodeMethod · 0.80
SetSkeletonProfileMethod · 0.80
StartGeneratingMethod · 0.45

Tested by

no test coverage detected