Updated iOS docs to use swift names in place of objective c names

This commit is contained in:
Prianka Liz Kariat
2023-08-25 18:06:50 +05:30
parent 6e6978cdbf
commit 3f0ec5969b
18 changed files with 342 additions and 384 deletions
@@ -53,28 +53,24 @@ NS_SWIFT_NAME(ImageClassifier)
@interface MPPImageClassifier : NSObject
/**
* Creates a new instance of `MPPImageClassifier` from an absolute path to a TensorFlow Lite model
* file stored locally on the device and the default `MPPImageClassifierOptions`.
* Creates a new instance of `ImageClassifier` from an absolute path to a TensorFlow Lite model file
* stored locally on the device and the default `ImageClassifierOptions`.
*
* @param modelPath An absolute path to a TensorFlow Lite model file stored locally on the device.
* @param error An optional error parameter populated when there is an error in initializing the
* image classifier.
*
* @return A new instance of `MPPImageClassifier` with the given model path. `nil` if there is an
* @return A new instance of `ImageClassifier` with the given model path. `nil` if there is an
* error in initializing the image classifier.
*/
- (nullable instancetype)initWithModelPath:(NSString *)modelPath error:(NSError **)error;
/**
* Creates a new instance of `MPPImageClassifier` from the given `MPPImageClassifierOptions`.
* Creates a new instance of `ImageClassifier` from the given `ImageClassifierOptions`.
*
* @param options The options of type `MPPImageClassifierOptions` to use for configuring the
* `MPPImageClassifier`.
* @param error An optional error parameter populated when there is an error in initializing the
* image classifier.
* @param options The options of type `ImageClassifierOptions` to use for configuring the
* `ImageClassifier`.
*
* @return A new instance of `MPPImageClassifier` with the given options. `nil` if there is an error
* in initializing the image classifier.
* @return A new instance of `ImageClassifier` with the given options. `nil` if there is an error in
* initializing the image classifier.
*/
- (nullable instancetype)initWithOptions:(MPPImageClassifierOptions *)options
error:(NSError **)error NS_DESIGNATED_INITIALIZER;
@@ -82,49 +78,46 @@ NS_SWIFT_NAME(ImageClassifier)
/**
* Performs image classification on the provided MPPImage using the whole image as region of
* interest. Rotation will be applied according to the `orientation` property of the provided
* `MPPImage`. Only use this method when the `MPPImageClassifier` is created with
* `MPPRunningModeImage`.
* This method supports classification of RGBA images. If your `MPPImage` has a source type of
* `MPPImageSourceTypePixelBuffer` or `MPPImageSourceTypeSampleBuffer`, the underlying pixel buffer
* must have one of the following pixel format types:
* `MPImage`. Only use this method when the `ImageClassifier` is created with running mode,
* `.image`.
*
* This method supports classification of RGBA images. If your `MPImage` has a source type
* ofm`.pixelBuffer` or `.sampleBuffer`, the underlying pixel buffer must have one of the following
* pixel format types:
* 1. kCVPixelFormatType_32BGRA
* 2. kCVPixelFormatType_32RGBA
*
* If your `MPPImage` has a source type of `MPPImageSourceTypeImage` ensure that the color space is
* RGB with an Alpha channel.
* If your `MPImage` has a source type of `.image` ensure that the color space is RGB with an Alpha
* channel.
*
* @param image The `MPPImage` on which image classification is to be performed.
* @param error An optional error parameter populated when there is an error in performing image
* classification on the input image.
*
* @return An `MPPImageClassifierResult` object that contains a list of image classifications.
* @return An `ImageClassifierResult` object that contains a list of image classifications.
*/
- (nullable MPPImageClassifierResult *)classifyImage:(MPPImage *)image
error:(NSError **)error
NS_SWIFT_NAME(classify(image:));
/**
* Performs image classification on the provided `MPPImage` cropped to the specified region of
* Performs image classification on the provided `MPImage` cropped to the specified region of
* interest. Rotation will be applied on the cropped image according to the `orientation` property
* of the provided `MPPImage`. Only use this method when the `MPPImageClassifier` is created with
* `MPPRunningModeImage`.
* of the provided `MPImage`. Only use this method when the `MPPImageClassifier` is created with
* running mode, `.image`.
*
* This method supports classification of RGBA images. If your `MPPImage` has a source type of
* `MPPImageSourceTypePixelBuffer` or `MPPImageSourceTypeSampleBuffer`, the underlying pixel buffer
* must have one of the following pixel format types:
* This method supports classification of RGBA images. If your `MPImage` has a source type of
* `.pixelBuffer` or `.sampleBuffer`, the underlying pixel buffer must have one of the following
* pixel format types:
* 1. kCVPixelFormatType_32BGRA
* 2. kCVPixelFormatType_32RGBA
*
* If your `MPPImage` has a source type of `MPPImageSourceTypeImage` ensure that the color space is
* RGB with an Alpha channel.
* If your `MPImage` has a source type of `.image` ensure that the color space is RGB with an Alpha
* channel.
*
* @param image The `MPPImage` on which image classification is to be performed.
* @param roi A `CGRect` specifying the region of interest within the given `MPPImage`, on which
* @param image The `MPImage` on which image classification is to be performed.
* @param roi A `CGRect` specifying the region of interest within the given `MPImage`, on which
* image classification should be performed.
* @param error An optional error parameter populated when there is an error in performing image
* classification on the input image.
*
* @return An `MPPImageClassifierResult` object that contains a list of image classifications.
* @return An `ImageClassifierResult` object that contains a list of image classifications.
*/
- (nullable MPPImageClassifierResult *)classifyImage:(MPPImage *)image
regionOfInterest:(CGRect)roi
@@ -132,30 +125,28 @@ NS_SWIFT_NAME(ImageClassifier)
NS_SWIFT_NAME(classify(image:regionOfInterest:));
/**
* Performs image classification on the provided video frame of type `MPPImage` using the whole
* Performs image classification on the provided video frame of type `MPImage` using the whole
* image as region of interest. Rotation will be applied according to the `orientation` property of
* the provided `MPPImage`. Only use this method when the `MPPImageClassifier` is created with
* `MPPRunningModeVideo`.
* the provided `MPImage`. Only use this method when the `MPPImageClassifier` is created with
* running mode `.video`.
*
* It's required to provide the video frame's timestamp (in milliseconds). The input timestamps must
* be monotonically increasing.
*
* This method supports classification of RGBA images. If your `MPPImage` has a source type of
* `MPPImageSourceTypePixelBuffer` or `MPPImageSourceTypeSampleBuffer`, the underlying pixel buffer
* must have one of the following pixel format types:
* This method supports classification of RGBA images. If your `MPImage` has a source type of
* `.pixelBuffer` or `.sampleBuffer`, the underlying pixel buffer must have one of the following
* pixel format types:
* 1. kCVPixelFormatType_32BGRA
* 2. kCVPixelFormatType_32RGBA
*
* If your `MPPImage` has a source type of `MPPImageSourceTypeImage` ensure that the color space is
* RGB with an Alpha channel.
* If your `MPImage` has a source type of `.image` ensure that the color space is RGB with an Alpha
* channel.
*
* @param image The `MPPImage` on which image classification is to be performed.
* @param timestampInMilliseconds The video frame's timestamp (in milliseconds). The input
* timestamps must be monotonically increasing.
* @param error An optional error parameter populated when there is an error in performing image
* classification on the input video frame.
*
* @return An `MPPImageClassifierResult` object that contains a list of image classifications.
* @return An `ImageClassifierResult` object that contains a list of image classifications.
*/
- (nullable MPPImageClassifierResult *)classifyVideoFrame:(MPPImage *)image
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
@@ -163,33 +154,30 @@ NS_SWIFT_NAME(ImageClassifier)
NS_SWIFT_NAME(classify(videoFrame:timestampInMilliseconds:));
/**
* Performs image classification on the provided video frame of type `MPPImage` cropped to the
* Performs image classification on the provided video frame of type `MPImage` cropped to the
* specified region of interest. Rotation will be applied according to the `orientation` property of
* the provided `MPPImage`. Only use this method when the `MPPImageClassifier` is created with
* `MPPRunningModeVideo`.
* the provided `MPImage`. Only use this method when the `ImageClassifier` is created with `.video`.
*
* It's required to provide the video frame's timestamp (in milliseconds). The input timestamps must
* be monotonically increasing.
*
* This method supports classification of RGBA images. If your `MPPImage` has a source type of
* `MPPImageSourceTypePixelBuffer` or `MPPImageSourceTypeSampleBuffer`, the underlying pixel buffer
* must have one of the following pixel format types:
* This method supports classification of RGBA images. If your `MPImage` has a source type of
* `.pixelBuffer` or `.sampleBuffer`, the underlying pixel buffer must have one of the following
* pixel format types:
* 1. kCVPixelFormatType_32BGRA
* 2. kCVPixelFormatType_32RGBA
*
* If your `MPPImage` has a source type of `MPPImageSourceTypeImage` ensure that the color space is
* RGB with an Alpha channel.
* If your `MPImage` has a source type of `.image` ensure that the color space is RGB with an Alpha
* channel.
*
* @param image A live stream image data of type `MPPImage` on which image classification is to be
* @param image A live stream image data of type `MPImage` on which image classification is to be
* performed.
* @param timestampInMilliseconds The video frame's timestamp (in milliseconds). The input
* timestamps must be monotonically increasing.
* @param roi A `CGRect` specifying the region of interest within the video frame of type
* `MPPImage`, on which image classification should be performed.
* @param error An optional error parameter populated when there is an error in performing image
* classification on the input video frame.
* `MPImage`, on which image classification should be performed.
*
* @return An `MPPImageClassifierResult` object that contains a list of image classifications.
* @return An `ImageClassifierResult` object that contains a list of image classifications.
*/
- (nullable MPPImageClassifierResult *)classifyVideoFrame:(MPPImage *)image
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
@@ -198,40 +186,38 @@ NS_SWIFT_NAME(ImageClassifier)
NS_SWIFT_NAME(classify(videoFrame:timestampInMilliseconds:regionOfInterest:));
/**
* Sends live stream image data of type `MPPImage` to perform image classification using the whole
* Sends live stream image data of type `MPImage` to perform image classification using the whole
* image as region of interest. Rotation will be applied according to the `orientation` property of
* the provided `MPPImage`. Only use this method when the `MPPImageClassifier` is created with
* the provided `MPImage`. Only use this method when the `ImageClassifier` is created with
* `MPPRunningModeLiveStream`.
*
* The object which needs to be continuously notified of the available results of image
* classification must confirm to `MPPImageClassifierLiveStreamDelegate` protocol and implement the
* `imageClassifier:didFinishClassificationWithResult:timestampInMilliseconds:error:`
* classification must confirm to `ImageClassifierLiveStreamDelegate` protocol and implement the
* `imageClassifier(_:didFinishClassificationWithResult:timestampInMilliseconds:error:)`
* delegate method.
*
* It's required to provide a timestamp (in milliseconds) to indicate when the input image is sent
* to the image classifier. The input timestamps must be monotonically increasing.
*
* This method supports classification of RGBA images. If your `MPPImage` has a source type of
* `MPPImageSourceTypePixelBuffer` or `MPPImageSourceTypeSampleBuffer`, the underlying pixel buffer
* must have one of the following pixel format types:
* This method supports classification of RGBA images. If your `MPImage` has a source type of
* .pixelBuffer` or `.sampleBuffer`, the underlying pixel buffer must have one of the following
* pixel format types:
* 1. kCVPixelFormatType_32BGRA
* 2. kCVPixelFormatType_32RGBA
*
* If the input `MPPImage` has a source type of `MPPImageSourceTypeImage` ensure that the color
* space is RGB with an Alpha channel.
* If the input `MPImage` has a source type of `.image` ensure that the color space is RGB with an
* Alpha channel.
*
* If this method is used for classifying live camera frames using `AVFoundation`, ensure that you
* request `AVCaptureVideoDataOutput` to output frames in `kCMPixelFormat_32RGBA` using its
* `videoSettings` property.
*
* @param image A live stream image data of type `MPPImage` on which image classification is to be
* @param image A live stream image data of type `MPImage` on which image classification is to be
* performed.
* @param timestampInMilliseconds The timestamp (in milliseconds) which indicates when the input
* image is sent to the image classifier. The input timestamps must be monotonically increasing.
* @param error An optional error parameter populated when there is an error in performing image
* classification on the input live stream image data.
*
* @return `YES` if the image was sent to the task successfully, otherwise `NO`.
* @return `true` if the image was sent to the task successfully, otherwise `false`.
*/
- (BOOL)classifyAsyncImage:(MPPImage *)image
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
@@ -239,42 +225,40 @@ NS_SWIFT_NAME(ImageClassifier)
NS_SWIFT_NAME(classifyAsync(image:timestampInMilliseconds:));
/**
* Sends live stream image data of type ``MPPImage`` to perform image classification, cropped to the
* Sends live stream image data of type `MPImage` to perform image classification, cropped to the
* specified region of interest.. Rotation will be applied according to the `orientation` property
* of the provided `MPPImage`. Only use this method when the `MPPImageClassifier` is created with
* `MPPRunningModeLiveStream`.
* of the provided `MPImage`. Only use this method when the `ImageClassifier` is created with
* `.liveStream`.
*
* The object which needs to be continuously notified of the available results of image
* classification must confirm to `MPPImageClassifierLiveStreamDelegate` protocol and implement the
* `imageClassifier:didFinishClassificationWithResult:timestampInMilliseconds:error:` delegate
* classification must confirm to `ImageClassifierLiveStreamDelegate` protocol and implement the
* `imageClassifier(_:didFinishClassificationWithResult:timestampInMilliseconds:error:)` delegate
* method.
*
* It's required to provide a timestamp (in milliseconds) to indicate when the input image is sent
* to the image classifier. The input timestamps must be monotonically increasing.
*
* This method supports classification of RGBA images. If your `MPPImage` has a source type of
* `MPPImageSourceTypePixelBuffer` or `MPPImageSourceTypeSampleBuffer`, the underlying pixel buffer
* must have one of the following pixel format types:
* This method supports classification of RGBA images. If your `MPImage` has a source type of
* `.pixelBuffer` or `.sampleBuffer`, the underlying pixel buffer must have one of the following
* pixel format types:
* 1. kCVPixelFormatType_32BGRA
* 2. kCVPixelFormatType_32RGBA
*
* If the input `MPPImage` has a source type of `MPPImageSourceTypeImage` ensure that the color
* space is RGB with an Alpha channel.
* If the input `MPImage` has a source type of `.image` ensure that the color space is RGB with an
* Alpha channel.
*
* If this method is used for classifying live camera frames using `AVFoundation`, ensure that you
* request `AVCaptureVideoDataOutput` to output frames in `kCMPixelFormat_32RGBA` using its
* `videoSettings` property.
*
* @param image A live stream image data of type `MPPImage` on which image classification is to be
* @param image A live stream image data of type `MPImage` on which image classification is to be
* performed.
* @param timestampInMilliseconds The timestamp (in milliseconds) which indicates when the input
* image is sent to the image classifier. The input timestamps must be monotonically increasing.
* @param roi A `CGRect` specifying the region of interest within the given live stream image data
* of type `MPPImage`, on which image classification should be performed.
* @param error An optional error parameter populated when there is an error in performing image
* classification on the input live stream image data.
* of type `MPImage`, on which image classification should be performed.
*
* @return `YES` if the image was sent to the task successfully, otherwise `NO`.
* @return `true` if the image was sent to the task successfully, otherwise `false`.
*/
- (BOOL)classifyAsyncImage:(MPPImage *)image
timestampInMilliseconds:(NSInteger)timestampInMilliseconds