SBSDKLicensePlateScanner

@interface SBSDKLicensePlateScanner : NSObject

A class for scanning a vehicles license plate in a small area and running a validation on the result. Ideally you use an instance of this class on subsequent video frames. Each scanned frame will raise the confidence of the scan.

  • The configuration of the license plate scanner. Can be set at any time.

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) SBSDKLicensePlateScannerConfiguration *configuration;

    Swift

    var configuration: SBSDKLicensePlateScannerConfiguration { get set }
  • Unavailable.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Designated initializer.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithConfiguration:
        (nonnull SBSDKLicensePlateScannerConfiguration *)configuration;

    Swift

    init(configuration: SBSDKLicensePlateScannerConfiguration)

    Parameters

    configuration

    The configuration of the license plate scanner.

    Return Value

    A newly created instance of the class.

  • The actual scan function. Scans a CMSampleBufferRef as received by AVFoundations camera API for a license plate and accumulates the result.

    Declaration

    Objective-C

    - (nullable SBSDKLicensePlateScannerResult *)
        scanSampleBuffer:(nonnull CMSampleBufferRef)sampleBufferRef
             orientation:(AVCaptureVideoOrientation)videoOrientation
                  inRect:(CGRect)rect;

    Swift

    func scanSampleBuffer(_ sampleBufferRef: CMSampleBuffer, orientation videoOrientation: AVCaptureVideoOrientation, in rect: CGRect) -> SBSDKLicensePlateScannerResult?

    Parameters

    sampleBufferRef

    The sample buffer reference.

    videoOrientation

    Video frame orientation. Should be the orientation that the device currently has, not actual image orientation.

    rect

    Rectangle in image coordinates in which to perform the scan. Must be within the boundaries of the video frame.

    Return Value

    The result of the scan.

  • The actual scan function. Scans a UIImage representation of a camera video frame for a license plate and accumulates the result.

    Caution: This function is not for scanning single images.

    Declaration

    Objective-C

    - (nullable SBSDKLicensePlateScannerResult *)scanVideoFrameImage:
                                                     (nonnull UIImage *)image
                                                              inRect:(CGRect)rect;

    Swift

    func scanVideoFrameImage(_ image: UIImage, in rect: CGRect) -> SBSDKLicensePlateScannerResult?

    Parameters

    image

    The orientation corrected image to scan.

    rect

    Rectangle in image coordinates in which to perform the scan. Must be within the boundaries of the video frame.

    Return Value

    The result of the scan.

  • Cleans the video frame accumulator. This basically resets the scanner to start a new scan.

    Declaration

    Objective-C

    - (void)clearFrameAccumulator;

    Swift

    func clearFrameAccumulator()