private string InitialiseImage() { string messages = ""; MapOutputMode imageMode = new MapOutputMode(); imageMode.XRes = FSize.Width; imageMode.YRes = FSize.Height; imageMode.FPS = 30; if (Mode == ImageNodeMode.RGB) { if (FIRGenerator != null) { FIRGenerator.StopGenerating(); FIRGenerator.Dispose(); } FRGBGenerator = new ImageGenerator(FState.Context); FRGBGenerator.MapOutputMode = imageMode; Image.Image.Initialise(FSize, TColorFormat.RGB8); if (FState.DepthGenerator.AlternativeViewpointCapability.IsViewpointSupported(FRGBGenerator)) { FState.DepthGenerator.AlternativeViewpointCapability.SetViewpoint(FRGBGenerator); } else { messages += "AlternativeViewportCapability not supported\n"; } FRGBGenerator.StartGenerating(); } else { if (FRGBGenerator != null) { FRGBGenerator.StopGenerating(); FRGBGenerator.Dispose(); } FIRGenerator = new IRGenerator(FState.Context); FIRGenerator.MapOutputMode = imageMode; FIRGenerator.StartGenerating(); Image.Image.Initialise(FSize, TColorFormat.L16); } return messages; }
private void Initialise() { try { FMode = FPinInMode[0]; Size size = new Size(640, 480); if (FMode == ImageNodeMode.RGB) { FImageGenerator = new ImageGenerator(FState.Context); FImageImage.Image.Initialise(size, TColourFormat.RGB8); FState.DepthGenerator.AlternativeViewpointCapability.SetViewpoint(FImageGenerator); FImageGenerator.StartGenerating(); } else { FIRGenerator = new IRGenerator(FState.Context); FImageImage.Image.Initialise(size, TColourFormat.L16); FIRGenerator.StartGenerating(); } FImageDepth.Image.Initialise(size, TColourFormat.L16); FImageWorld.Image.Initialise(size, TColourFormat.RGB32F); FPinOutImageImage[0] = FImageImage.Link; FPinOutImageDepth[0] = FImageDepth.Link; FPinOutImageWorld[0] = FImageWorld.Link; for (int x = 0; x < 640; x++) for (int y = 0; y < 480; y++) { FProjective[x + y * 640].X = x; FProjective[x + y * 640].Y = y; } FState.Update += new EventHandler(FState_Update); FStatus = "OK"; } catch (StatusException e) { FStatus = e.Message; } }