public AddLicense ( License license ) : void | ||
license | License | |
Résultat | void |
// private ctor for singleton private OpenNIContext() { this.context = new Context(); if (null == context) { return; } if (oniFile != "") { context.OpenFileRecording(oniFile); } // NITE license from OpenNI.org License ll = new License(); ll.Key = "0KOIk2JeIBYClPWVnMoRKn5cdY4="; ll.Vendor = "PrimeSense"; context.AddLicense(ll); this.Depth = openNode(NodeType.Depth) as DepthGenerator; this.mirror = this.Depth.MirrorCapability; if (oniFile == "") { this.Mirror = true; } }
public void Awake() { Debug.Log("Initing OpenNI" + (LoadFromXML ? "(" + XMLFilename + ")" : "")); try { this.context = LoadFromXML ? new Context(XMLFilename) : new Context(); } catch (Exception ex) { Debug.LogError("Error opening OpenNI context: " + ex.Message); return; } // add license manually if not loading from XML if (!LoadFromXML) { License ll = new License(); ll.Key = LicenseKey; ll.Vendor = LicenseVendor; context.AddLicense(ll); } if (LoadFromRecording) { context.OpenFileRecordingEx(RecordingFilename); Player player = openNode(NodeType.Player) as Player; player.PlaybackSpeed = 0.0; StartCoroutine(ReadNextFrameFromRecording(player)); } this.Depth = openNode(NodeType.Depth) as DepthGenerator; this.mirrorCap = this.Depth.MirrorCapability; if (!LoadFromRecording) { this.mirrorCap.SetMirror(Mirror); mirrorState = Mirror; } }
void Open(int i) { try { Close(i); OpenNIState state = FState[i]; var context = new Context(); FState[i].Context = context; context.AddLicense(FLicense); context.GlobalMirror = false; NodeInfoList list = context.EnumerateProductionTrees(global::OpenNI.NodeType.Device, null); NodeInfo node = null; if (FPinInNodes[i] != "") { foreach (NodeInfo nodeitem in list) { if (nodeitem.CreationInfo == FPinInNodes[i]) { node = nodeitem; break; } } if (node == null) throw (new Exception("This device is unavailable. Check upstream ListDevices node")); context.CreateProductionTree(node); } state.DepthGenerator = new DepthGenerator(context); MapOutputMode depthMode = new MapOutputMode(); depthMode.FPS = 30; depthMode.XRes = 640; depthMode.YRes = 480; state.DepthGenerator.MapOutputMode = depthMode; state.DepthGenerator.StartGenerating(); state.Start(); FPinOutContext[i] = state; FPinOutStatus[i] = "OK"; } catch (Exception e) { Close(i); FPinOutStatus[i] = e.Message; } }