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.