MediaPipeTasksVision Framework Reference

MPPFaceStylizer

  @interface 
 MPPFaceStylizer 
 : 
 NSObject 
 

Class that performs face stylization on images.

  • Creates a new instance of FaceStylizer from an absolute path to a model bundle stored locally on the device and the default FaceStylizer .

    Declaration

    Objective-C

      - 
     ( 
     nullable 
     instancetype 
     ) 
     initWithModelPath 
     :( 
     nonnull 
     NSString 
     * 
     ) 
     modelPath 
     error 
     :( 
     NSError 
     * 
     _Nullable 
     * 
     _Nullable 
     ) 
     error 
     ; 
     
    

    Parameters

    modelPath

    An absolute path to a TensorFlow Lite model file stored locally on the device.

    Return Value

    A new instance of FaceStylizer with the given model path. nil if there is an error in initializing the face stylizer.

  • Creates a new instance of FaceStylizer from the given FaceStylizerOptions .

    Declaration

    Objective-C

      - 
     ( 
     nullable 
     instancetype 
     ) 
     initWithOptions 
     : 
     ( 
     nonnull 
      MPPFaceStylizerOptions 
     
     * 
     ) 
     options 
     error 
     :( 
     NSError 
     * 
     _Nullable 
     * 
     _Nullable 
     ) 
     error 
     ; 
     
    

    Parameters

    options

    The options of type FaceStylizerOptions to use for configuring the FaceStylizer .

    Return Value

    A new instance of FaceStylizer with the given options. nil if there is an error in initializing the face stylizer.

  • Performs face stylization on the provided MPImage and returns a FaceStylizerResult containing a copy of the stylized image. This method should not be used in high-throughput applications since the returned image is copied. Rotation will be applied according to the orientation property of the provided MPImage .

    This method supports face stylization RGBA images. If your MPImage has a source type of .pixelBuffer or .sampleBuffer , the underlying pixel buffer must use kCVPixelFormatType_32BGRA as its pixel format.

    If your MPImage has a source type of .image ensure that the color space is RGB with an Alpha channel.

    Declaration

    Objective-C

      - 
     ( 
     nullable 
      MPPFaceStylizerResult 
     
     * 
     ) 
     stylizeImage 
     :( 
     nonnull 
      MPPImage 
     
     * 
     ) 
     image 
     error 
     :( 
     NSError 
     * 
     _Nullable 
     * 
     _Nullable 
     ) 
     error 
     ; 
     
    

    Parameters

    image

    The MPImage on which face stylization is to be performed.

    Return Value

    A FaceStylizerResult that contains the stylized image of the most visible face. The returned image is copied. The stylized output image size is the same as the model output size. The stylizedImage of the FaceStylizerResult is nil if there is no face detected in the input image. FaceStylizerResult is nil if there is an error in initializing the face stylizer.

  • Performs face stylization on the provided MPImage and returns a FaceStylizerResult containing a copy of the stylized image. This method should not be used in high-throughput applications since the returned image is copied. Rotation will be applied according to the orientation property of the provided MPImage .

    This method supports face stylization RGBA images. If your MPImage has a source type of .pixelBuffer or .sampleBuffer , the underlying pixel buffer must use kCVPixelFormatType_32BGRA as its pixel format.

    If your MPImage has a source type of .image ensure that the color space is RGB with an Alpha channel.

    Declaration

    Objective-C

      - 
     ( 
     nullable 
      MPPFaceStylizerResult 
     
     * 
     ) 
     stylizeImage 
     :( 
     nonnull 
      MPPImage 
     
     * 
     ) 
     image 
     regionOfInterest 
     :( 
     CGRect 
     ) 
     regionOfInterest 
     error 
     :( 
     NSError 
     * 
     _Nullable 
     * 
     _Nullable 
     ) 
     error 
     ; 
     
    

    Parameters

    image

    The MPImage on which face stylization is to be performed.

    Return Value

    A FaceStylizerResult that contains the stylized image of the most visible face. The returned image is copied. The stylized output image size is the same as the model output size. The stylizedImage of the FaceStylizerResult is nil if there is no face detected in the input image. FaceStylizerResult is nil if there is an error in initializing the face stylizer.

  • Undocumented

    Declaration

    Objective-C

      - 
     ( 
     instancetype 
     ) 
     init 
     NS_UNAVAILABLE 
     ; 
     
    
  • Undocumented

    Declaration

    Objective-C

      + 
     ( 
     instancetype 
     ) 
     new 
     NS_UNAVAILABLE 
     ; 
     
    
Create a Mobile Website
View Site in Mobile | Classic
Share by: