GSKDocumentDetector

Objective-C

@interface GSKDocumentDetector : NSObject

Swift

class GSKDocumentDetector : NSObject
  • Performance: A document detector can be expensive to create: it’s recommended to keep a reference to it if it’s needed several times in a row.
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithConfiguration:(GSKDocumentDetectorConfiguration *)configuration NS_DESIGNATED_INITIALIZER;

    Swift

    init(configuration: GSKDocumentDetectorConfiguration)
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    convenience init()
  • Detects the quadrangle corresponding to the edges of a document in video frame

    Declaration

    Objective-C

    - (GSKDocumentDetectionResult *_Nullable)
        detectDocumentInSampleBuffer:(nonnull CMSampleBufferRef)sampleBuffer
                               error:(NSError *_Nullable *_Nullable)error;

    Swift

    func detectDocument(in sampleBuffer: CMSampleBuffer) throws -> GSKDocumentDetectionResult

    Parameters

    sampleBuffer

    a YCbCr sample buffer of a video frame. Make sure the video output generating these frames is configured with the pixel format kCVPixelFormatType_420YpCbCr8BiPlanarFullRange

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    The detected quadrangle or nil if an error occured.

  • Detects the quadrangle corresponding to the edges of a document in a photo

    Declaration

    Objective-C

    - (GSKDocumentDetectionResult *_Nullable)
        detectDocumentInImage:(nonnull UIImage *)image
                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    func detectDocument(in image: UIImage) throws -> GSKDocumentDetectionResult

    Parameters

    image

    The photo to detect a document in

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    The detected quadrangle or nil if an error occured.