Skip to content

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Core Image Detectors
using System;
using MonoTouch.CoreImage;
using MonoTouch.UIKit;
namespace CIDetectorsDemo
public class DetectorController : UIViewController
UIImageView imageView;
public override void ViewDidLoad ()
base.ViewDidLoad ();
var imageIn = UIImage.FromBundle("card.jpg");
//var imageIn = UIImage.FromBundle("qrcode.png");
var context = CIContext.FromOptions (null);
var options = new CIDetectorOptions {
Accuracy = FaceDetectorAccuracy.High
var detector = CIDetector.CreateRectangleDetector (context, options);
//var detector = CIDetector.CreateQRDetector (context, options);
var ciImage = CIImage.FromCGImage (imageIn.CGImage);
var features = detector.FeaturesInImage (ciImage);
var overlay = CIImage.ImageWithColor (CIColor.FromRgba (1.0f, 0.0f, 0.0f, 0.7f));
overlay = overlay.ImageByCroppingToRect (features [0].Bounds);
var ciImageWithOverlay = overlay.CreateByCompositingOverImage (ciImage);
var imageOut = UIImage.FromImage (ciImageWithOverlay);
imageView = new UIImageView (imageOut);
imageView.Frame = View.Frame;
Add (imageView);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.