当前位置: 首页>>代码示例>>C#>>正文


C# Context.EnumerateProductionTrees方法代码示例

本文整理汇总了C#中OpenNI.Context.EnumerateProductionTrees方法的典型用法代码示例。如果您正苦于以下问题:C# Context.EnumerateProductionTrees方法的具体用法?C# Context.EnumerateProductionTrees怎么用?C# Context.EnumerateProductionTrees使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenNI.Context的用法示例。


在下文中一共展示了Context.EnumerateProductionTrees方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Open

        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;
			}
		}
开发者ID:smakhtin,项目名称:VVVV.Nodes.Image,代码行数:52,代码来源:ContextNode.cs

示例2: Initialize

		public void Initialize()
		{
			//Dispose();

			try
			{
				m_MasterContext = new Context();

				NodeInfoList deviceList = m_MasterContext.EnumerateProductionTrees(NodeType.Device, null);

				int deviceCount = 0;
				foreach (NodeInfo nodeInfo in deviceList)
				{
					deviceCount++;
					/* 
					RC.WriteLine("Device: " + nodeInfo.InstanceName);
					RC.WriteLine("Node: " + nodeInfo.CreationInfo);
					RC.WriteLine("Name: " + nodeInfo.Description.Name.ToString());
					RC.WriteLine("Vendor: " + nodeInfo.Description.Vendor.ToString());
					RC.WriteLine("Version: " + nodeInfo.Description.Version.ToString());
					RC.WriteLine("");
					*/
				}

				RC.WriteLine(ConsoleThemeColor.TitleText1, deviceCount + " Kinect Devices Detected");

				NodeInfoList depthList = m_MasterContext.EnumerateProductionTrees(NodeType.Depth, null);

				int depthSourceCount = 0;
				foreach (NodeInfo nodeInfo in depthList)
				{
					depthSourceCount++;
					/* 
					RC.WriteLine("Depth Image Source: " + nodeInfo.InstanceName);
					RC.WriteLine("Node: " + nodeInfo.CreationInfo);
					RC.WriteLine("Name: " + nodeInfo.Description.Name.ToString());
					RC.WriteLine("Vendor: " + nodeInfo.Description.Vendor.ToString());
					RC.WriteLine("Version: " + nodeInfo.Description.Version.ToString());
					RC.WriteLine("");
					*/
				}

				RC.WriteLine(ConsoleThemeColor.TitleText1, depthSourceCount + " Depth Image Sources Detected");


				int deviceIndex = 0;

				foreach (NodeInfo nodeInfo in depthList)
				{
					DepthGenerator depth = m_MasterContext.CreateProductionTree(nodeInfo) as DepthGenerator;

					if (depth == null)
					{
						throw new Exception("Viewer must have a depth node!");
					}

					//MapOutputMode requiredMode = new MapOutputMode() { FPS = 30, XRes = 320, YRes = 240 };

					//depth.MapOutputMode = requiredMode;
					RC.WriteLine(ConsoleThemeColor.TitleText1, "Device: " + deviceIndex);
					/* 
					MapOutputMode selectedMode = depth.MapOutputMode; 

					foreach (MapOutputMode mode in depth.GetSupportedMapOutputModes())
					{
						RC.WriteLine(ConsoleThemeColor.Text1, "Mode:" + mode.XRes + "x" + mode.YRes + ", " + mode.FPS + " FPS");

						if (mode.XRes == 320 && mode.YRes == 240 && mode.FPS == 60)
						{
							selectedMode = mode;
						}
					}
				
					depth.MapOutputMode = selectedMode; 

					MapOutputMode mapMode = depth.MapOutputMode;
					*/

					ImageResolution ColorResolution = ImageResolution.Invalid;
					ImageResolution DepthResolution = ImageResolution.Resolution320x240;

					/* if (mapMode.XRes == 320 && mapMode.YRes == 240)
					{
						DepthResolution = ImageResolution.Resolution320x240;
					}
					else if (mapMode.XRes == 640 && mapMode.YRes == 480)
					{
						DepthResolution = ImageResolution.Resolution640x480;
					}
					else
					{
						DepthResolution = ImageResolution.Invalid;
					}
					 * */

					Devices.Add(new KinectDevice(deviceIndex++, depth, DepthResolution, ColorResolution));
				}

			}
			catch (Exception ex)
//.........这里部分代码省略.........
开发者ID:RugCode,项目名称:drg-pt,代码行数:101,代码来源:KinectDeviceMaster.cs


注:本文中的OpenNI.Context.EnumerateProductionTrees方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。