private void applySepiaFilter(float sepiaIntensity)
        {
            // Apply a filter
            GPUImageSepiaFilter filter = new GPUImageSepiaFilter();
            filter.Intensity = sepiaIntensity;

            // Create image object to process
            GPUImagePicture stillImageSource = new GPUImagePicture(image, true);
            stillImageSource.AddTarget(filter);

            filter.AddTarget(imageView);

            // Launch the process
            stillImageSource.ProcessImage();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            stillCamera = new GPUImageStillCamera();
            stillCamera.OutputImageOrientation = InterfaceOrientation;

            pixellateFilter = new GPUImagePixellateFilter();
            sepiaFilter     = new GPUImageSepiaFilter();

            stillCamera.AddTarget(pixellateFilter);
            pixellateFilter.AddTarget(sepiaFilter);
            sepiaFilter.AddTarget(imageView);

            stillCamera.StartCameraCapture();
        }
Exemplo n.º 3
0
        private void applySepiaFilter(float sepiaIntensity)
        {
            // Apply a filter
            GPUImageSepiaFilter filter = new GPUImageSepiaFilter();

            filter.Intensity = sepiaIntensity;

            // Create image object to process
            GPUImagePicture stillImageSource = new GPUImagePicture(image, true);

            stillImageSource.AddTarget(filter);

            filter.AddTarget(imageView);

            // Launch the process
            stillImageSource.ProcessImage();
        }
Exemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            videoCamera = new GPUImageVideoCamera(AVCaptureSession.Preset640x480, AVCaptureDevicePosition.Back);
            videoCamera.OutputImageOrientation = InterfaceOrientation;
            videoCamera.HorizontallyMirrorFrontFacingCamera = false;
            videoCamera.HorizontallyMirrorRearFacingCamera  = false;

            pixellateFilter = new GPUImagePixellateFilter();
            sepiaFilter     = new GPUImageSepiaFilter();

            videoCamera.AddTarget(pixellateFilter);
            pixellateFilter.AddTarget(sepiaFilter);
            sepiaFilter.AddTarget(imageView);

            videoCamera.StartCameraCapture();
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			stillCamera = new GPUImageStillCamera ();
			stillCamera.OutputImageOrientation = InterfaceOrientation;

			filter1 = GPUImageFilter.FromFragmentShaderFile ("Shader1");
			filter2 = GPUImageFilter.FromFragmentShaderFile ("Shader2");
			filter3 = new GPUImageSepiaFilter ();

			stillCamera.AddTarget (topLeftImageView);
			stillCamera.AddTarget (filter1);
			filter1.AddTarget (topRightImageView);
			stillCamera.AddTarget (filter2);
			filter2.AddTarget (bottomLeftImageView);
			stillCamera.AddTarget (filter3);
			filter3.AddTarget (bottomRightImageView);
			
			stillCamera.StartCameraCapture ();
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            stillCamera = new GPUImageStillCamera();
            stillCamera.OutputImageOrientation = InterfaceOrientation;

            filter1 = GPUImageFilter.FromFragmentShaderFile("Shader1");
            filter2 = GPUImageFilter.FromFragmentShaderFile("Shader2");
            filter3 = new GPUImageSepiaFilter();

            stillCamera.AddTarget(topLeftImageView);
            stillCamera.AddTarget(filter1);
            filter1.AddTarget(topRightImageView);
            stillCamera.AddTarget(filter2);
            filter2.AddTarget(bottomLeftImageView);
            stillCamera.AddTarget(filter3);
            filter3.AddTarget(bottomRightImageView);

            stillCamera.StartCameraCapture();
        }
        async partial void OnFilterSelectorChanged(UISegmentedControl sender)
        {
            switch (sender.SelectedSegment)
            {
            case 0:
                // Set up a manual image filtering chain
                var vignetteFilter = new GPUImageVignetteFilter();
                vignetteFilter.VignetteEnd   = 0.6f;
                vignetteFilter.VignetteStart = 0.4f;

                var sepiaFilter = new GPUImageSepiaFilter();
                sepiaFilter.AddTarget(vignetteFilter);

                var imageSource = new GPUImagePicture(inputImageUrl);
                imageSource.AddTarget(sepiaFilter);

                vignetteFilter.UseNextFrameForImageCapture();
                await imageSource.ProcessImageAsync();

                using (var currentImage = vignetteFilter.ToImage())
                    using (var pngData = currentImage.AsPNG()) {
                        pngData.Save(path1, true);
                    }

                imageView.Image = UIImage.FromFile(path1);
                break;

            case 1:
                // Do a simpler image filtering
                var imageFilter = new GPUImageSketchFilter();

                using (var quickFilteredImage = imageFilter.CreateFilteredImage(inputImage))
                    using (var pngData = quickFilteredImage.AsPNG()) {
                        pngData.Save(path2, true);
                    }

                imageView.Image = UIImage.FromFile(path2);
                break;
            }
        }
		async partial void OnFilterSelectorChanged (UISegmentedControl sender)
		{
			switch (sender.SelectedSegment) {
			case 0:
				// Set up a manual image filtering chain
				var vignetteFilter = new GPUImageVignetteFilter ();
				vignetteFilter.VignetteEnd = 0.6f;
				vignetteFilter.VignetteStart = 0.4f;

				var sepiaFilter = new GPUImageSepiaFilter ();
				sepiaFilter.AddTarget (vignetteFilter);

				var imageSource = new GPUImagePicture (inputImageUrl);
				imageSource.AddTarget (sepiaFilter);

				vignetteFilter.UseNextFrameForImageCapture ();
				await imageSource.ProcessImageAsync ();

				using (var currentImage = vignetteFilter.ToImage ())
				using (var pngData = currentImage.AsPNG ()) {
					pngData.Save (path1, true);
				}

				imageView.Image = UIImage.FromFile (path1);
				break;

			case 1:
				// Do a simpler image filtering
				var imageFilter = new GPUImageSketchFilter ();

				using (var quickFilteredImage = imageFilter.CreateFilteredImage (inputImage))
				using (var pngData = quickFilteredImage.AsPNG ()) {
					pngData.Save (path2, true);
				}

				imageView.Image = UIImage.FromFile (path2);
				break;
			}
		}