GMLImage
@interface GMLImage : NSObject设备端机器学习中使用的图片。
-
此图片的宽度,以像素为单位。
声明
Objective-C
@property (nonatomic, readonly) CGFloat width; -
图片的高度(以像素为单位)。
声明
Objective-C
@property (nonatomic, readonly) CGFloat height; -
图片的显示方向。如果
imageSourceType为.image,则默认值为image.imageOrientation;否则,默认值为.up。声明
Objective-C
@property (nonatomic) int orientation; -
图片来源的类型。
声明
Objective-C
@property (nonatomic, readonly) GMLImageSourceType imageSourceType; -
来源映像。如果
imageSourceType不为.image,则为nil。声明
Objective-C
@property (nonatomic, readonly, nullable) int *image; -
源像素缓冲区。如果
imageSourceType不为.pixelBuffer,则为nil。声明
Objective-C
@property (nonatomic, readonly, nullable) CVPixelBufferRef pixelBuffer; -
源样本缓冲区。如果
imageSourceType不为.sampleBuffer,则为nil。声明
Objective-C
@property (nonatomic, readonly, nullable) CMSampleBufferRef sampleBuffer; -
使用给定图片初始化
MLImage对象。声明
Objective-C
- (nullable instancetype)initWithImage:(id)image;参数
image要用作来源的映像。其
CGImage属性不得为NULL。返回值
以给定映像作为来源的新
MLImage实例。nil(如果给定的image) 为nil或无效。 -
使用指定的像素缓冲区初始化
MLImage对象。声明
Objective-C
- (nullable instancetype)initWithPixelBuffer: (nonnull CVPixelBufferRef)pixelBuffer;参数
pixelBuffer要用作源的像素缓冲区。新的
MLImage实例在其生命周期内一直有效。返回值
以给定像素缓冲区作为源的新
MLImage实例。nil如果指定 像素缓冲区为nil或无效。 -
使用指定的示例缓冲区初始化
MLImage对象。声明
Objective-C
- (nullable instancetype)initWithSampleBuffer: (nonnull CMSampleBufferRef)sampleBuffer;参数
sampleBuffer要用作来源的示例缓冲区。新的
MLImage实例在其生命周期内一直有效。样本缓冲区必须基于 像素缓冲区(非压缩数据)。实际上,它应该是摄像头的视频输出 而不是其他任意类型的CMSampleBuffer。返回值
以给定的样本缓冲区作为源的新
MLImage实例。nil如果指定 样本缓冲区为nil或无效。 -
不可用。
声明
Objective-C
- (nonnull instancetype)init;