3

What I need todo is make a Scanner to scan the documents. Currently I am using CIDetector to detect any rectangle using type CIDetectorTypeRectangle

func detectRectangleInScanner() -> CIDetector {

    let options: [String: AnyObject] = [CIDetectorAccuracy: CIDetectorAccuracyHigh]
    return CIDetector(ofType: CIDetectorTypeRectangle, context: nil, options: options)

}

It's working fine and detecting the rectangles with edges.

Now I have made a scanner-view overlay with the four corners such that if the document lies within those overlay frame then only the scanner will detect that document. Video Link

AVCaptureMetadataOutput has a property rectOfInterest that does the same thing, but unfortunately it can't be used for document scanning.

Himanshu Joshi
  • 3,391
  • 1
  • 19
  • 32
  • AVCaptureMetadataOutput's rectOfInterest doesn't detect rectangles. It's just the region to search for metadata (face, qrcode). – stefos May 12 '16 at 15:26
  • Yes, I know that. My question is how can we get the same thing using `AVFoundation` and `CIDetector`? See the video link – Himanshu Joshi May 12 '16 at 15:33

0 Answers0