/// <summary> /// Once we have a context, we are able to peform various setup routines /// that require us to connect to OpenGL. /// </summary> protected override void OnSetContext() { //fCamera1 = VideoTexture.CreateFromDeviceIndex(GI, 0, 640, 480); fCamera1 = VideoTexture.CreateFromDeviceIndex(GI, 0, true); // Turn off features that we don't need, and they // just slow down video processing GI.Features.AlphaTest.Disable(); GI.Features.Blend.Disable(); GI.Features.DepthTest.Disable(); GI.Features.Dither.Disable(); GI.Features.Fog.Disable(); GI.Features.Lighting.Disable(); // Create the FaceMesh that will receive the gray texture so we // can break it up into 8x8 squares fFaceSize = new Vector3D(fCamera1.Width, fCamera1.Height, 0); fBackgroundCreator = new RGBToGray(GI, fCamera1.Width, fCamera1.Height); fBackgroundCopier = new UnaryTextureProcessor(GI, fCamera1.Width, fCamera1.Height); fBackgroundPixellator = new Pixellate(GI, fCamera1.Width, fCamera1.Height, 8); fImageOperator = new UnaryTextureProcessor(GI, fCamera1.Width, fCamera1.Height); fGrayConverter = new RGBToGray(GI, fCamera1.Width, fCamera1.Height); fGammaCorrection = new PowerLawTransform(GI, fCamera1.Width, fCamera1.Height, 1.0f); fLuminanceThreshold = new LuminanceThreshold(GI, fCamera1.Width, fCamera1.Height, 0f); fLuminanceBinarizer = new LuminanceBinarizer(GI, fCamera1.Width, fCamera1.Height, 0.3f); fLuminanceBinarizer.OverColor = ColorRGBA.Black; fLuminanceBinarizer.UnderColor = ColorRGBA.White; fPixellate = new Pixellate(GI, fCamera1.Width, fCamera1.Height,8); fBlocker = new BlockProcessor(GI, fCamera1.Width, fCamera1.Height, 2); fAverager = new AverageProcessor(GI, fCamera1.Width, fCamera1.Height); fMorpher = new Morph(GI, fCamera1.Width, fCamera1.Height); fEdgeEnhance = new ConvolutionProcessor(GI, fCamera1.Width, fCamera1.Height, ConvolutionKernel.EdgeEnhance); fEdgeEnhance.Distance = 4; fEmboss = new ConvolutionProcessor(GI, fCamera1.Width, fCamera1.Height, ConvolutionKernel.Emboss); fSoften = new ConvolutionProcessor(GI, fCamera1.Width, fCamera1.Height, ConvolutionKernel.GaussianBlur); fSoften.Distance = 4; fSobell = new ConvolutionProcessor(GI, fCamera1.Width, fCamera1.Height, ConvolutionKernel.Sobell); fLaplacian = new ConvolutionProcessor(GI, fCamera1.Width, fCamera1.Height, ConvolutionKernel.Laplacian); fDifference = new DifferenceProcessor(GI, fCamera1.Width, fCamera1.Height); // We want replace mode because we don't care about // the values that are currently in place, we just want // to replace them. GI.TexEnv(TextureEnvModeParam.Replace); fGrayMesh = new XYAxesMesh(GI, new Vector3D(fCamera1.Width, fCamera1.Height, 0), new Resolution(2, 2), null); fPointMesh = new XYAxesPointMesh(GI, new Vector3D(fCamera1.Width, fCamera1.Height, 0), new Resolution(fCamera1.Width/4, fCamera1.Height/4), null); }
public BlockProcessor(GraphicsInterface gi, int width, int height, int blockSize) : base(gi, width, height, UnaryTextureProcessor.FixedFrag) { fBlockSize = 8; fPointMesh = new XYAxesPointMesh(gi, new Vector3D(width, height, 0), new Resolution(width / blockSize, height / blockSize), null); }