예제 #1
0
		//called when data for any output pin is requested
		public void Evaluate(int SpreadMax)
		{
			if (FPinInImages[0] != FImage)
			{
				FImage = FPinInImages[0];
				FImage.ImageUpdate += new EventHandler(FImage_ImageUpdate);
			}

			lock (FLock)
			{
				while (FInput.Count < SpreadMax)
					FInput.Add(new Vector2D());
				while (FInput.Count > SpreadMax)
					FInput.RemoveAt(0);
				while (FOutput.Count < FInput.Count)
					FOutput.Add(new Vector3D());
				while (FOutput.Count > FInput.Count)
					FOutput.RemoveAt(0);

				for (int i = 0; i < FPinInInput.SliceCount; i++)
				{
					FInput[i] = FPinInInput[i];
				}
				Output();
			}

		}
예제 #2
0
		//called when data for any output pin is requested
		public void Evaluate(int SpreadMax)
		{
			if (FPinInContext[0] != FContext)
			{
				FContext = FPinInContext[0];
			}

			if (FContext == null)
			{
				FRunning = false;
				return;
			}

			if (FContext.running && !FRunning && FContext.context != null)
			{
				try
				{
					FImageGenerator = FContext.context.FindExistingNode(global::OpenNI.NodeType.Image) as ImageGenerator;
					FDepthGenerator = FContext.context.FindExistingNode(global::OpenNI.NodeType.Depth) as DepthGenerator;
					FDepthGenerator.AlternativeViewpointCapability.SetViewpoint(FImageGenerator);

					FImageRGB = new ImageRGB();
					FImageDepth = new ImageL16();
					FImageWorld = new ImageRGB32F();

					Size size = new Size(640, 480);
					FImageRGBBuffer = new Image<Bgr, byte>(size);
					FImageDepthBuffer = new Image<Gray,ushort>(size);
					FImageWorldBuffer = new Image<Rgb, float>(size);

					FPinOutRGB[0] = FImageRGB;
					FPinOutDepth[0] = FImageDepth;
					FPinOutWorld[0] = FImageWorld;

					FThread = new Thread(fnThread);
					FRunning = true;
					FThread.Start();
					FPinOutStatus[0] = "OK";
				}
				catch (StatusException e)
				{
					FRunning = false;
					FPinOutStatus[0] = e.Message;
				}
			}


		}