LMBestShotService

final public class LMBestShotService: NSObject, LMBestShotServiceProtocol,
                                      LunaCore.LCBestShotDelegate, LMErrorPresenterDelegate

Service that handles bestshot processing

  • Best shot service delegate

    Declaration

    Swift

    public weak var delegate: LMBestShotServiceDelegate?
  • Best shot detector object

    Declaration

    Swift

    public private(set) var detector: LunaCore.LCBestShotDetectorProtocol { get }
  • Push frame data to bestshot detector

    Declaration

    Swift

    public func pushFrame(buffer sampleBuffer: CMSampleBuffer)

    Parameters

    sampleBuffer

    buffer data

  • Push image to bestshot detector

    Declaration

    Swift

    public func pushFrame(image: CGImage)

    Parameters

    image

    image

  • Resume bestshot detection

    Declaration

    Swift

    public func resume()
  • Sets detector’s screen (search zone) size

    Declaration

    Swift

    public func screenSize(_ size: CGSize, edges: UIEdgeInsets)

    Parameters

    size

    zone size (usually screen)

    edges

    edge insets

  • Ask detector if any face founded

    Declaration

    Swift

    public func faceFound() -> Bool

    Return Value

    true - if face was founded, false - otherwhise

  • Launch interactions wizard

    Declaration

    Swift

    public func launchWizard()
  • Send a message to engine, that you have show interaction hint to the user

    Declaration

    Swift

    public func interactionHintDidShow()
  • Setup interactions list

    Declaration

    Swift

    public func defineStepsList(_ stepsList: [LCStepConfigProtocol])

    Parameters

    stepsList

    interactions array

  • Enable video recording

    Declaration

    Swift

    public func enableVideoRecordWatchDog(faceFoundBlock: @escaping FaceFoundedBlock)

    Parameters

    faceFoundBlock

    block that is triggered after a face is detected in the frame

LCBestShotDelegate

  • Called when a face is detected in the shot.

    Declaration

    Swift

    public func detectionRect(_ rect: CGRect, inFrameSize frameSize: CGSize)

    Parameters

    rect

    Face detection zone

    frameSize

    Frame size

  • Called when the best shot is found. @note If false is returned, a process of the best shot detection will continue, otherwise the process will be paused. Recall a resume method to continue the process after a pause.

    Declaration

    Swift

    public func bestShot(_ bestShot: LunaCore.LCBestShotModel) -> Bool

    Parameters

    bestShot

    The best shot of the face.

    Return Value

    Return true, if the new best shots are no longer needed.

  • Called when the best shot is collected. @note This method is called only if isMultipartBestShots is set to true. If false is returned, a process of the best shot detection will continue, otherwise the process will be paused. Recall a resume method to continue the process after a pause.

    Declaration

    Swift

    public func multipartBestShots(_ bestShots: [LCBestShotModel]) -> Bool

    Parameters

    bestShots

    The best shots of the face.

    Return Value

    Return true, if the new best shots are no longer needed.

  • Returns errors array received upon last second. User defines array size.

    Declaration

    Swift

    public func bestShotError(_ error: Error)

    Parameters

    errors

    Errors array, sized from 0 to 3 elements

  • Returns an array of frames with the interaction action performed.

    Declaration

    Swift

    public func interactionsFinish(with interactionFrames: [LCInteractionFrameInfo])

    Parameters

    interactionFrames

    array of successful interactions with their descriptions

LCErrorPresenterDelegate

  • Returns an array of the most frequent errors that occurred in the last second.

    Declaration

    Swift

    public func send(errors: [Error])

    Parameters

    errors

    An array of errors sorted by frequency in descending order