合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
扫码工具类,提供BitMap Mode扫码方式。
Declaration
@interface HmsBitMap : NSObject
初始化方法:
HmsBitMap *bitMap = [[HmsBitMap alloc] init];
获取图片image,传入算法获取单码解码结果。请参见图片扫码。
Declaration
+(NSDictionary *)bitMapForImage:(UIImage *)image withOptions:(HmsScanOptions *)options
调用示例:
[bitMap bitMapForImage:(UIImage *)image withOptions:(HmsScanOptions *)options];
获取图片帧sampleBuffer,传入算法获取单码解码结果。请参见图片扫码。
Declaration
+(NSDictionary *)bitMapForSampleBuffer:(CMSampleBufferRef)sampleBuffer withOptions:(HmsScanOptions *)options
调用示例:
[bitMap bitMapForSampleBuffer:(CMSampleBufferRef)sampleBuffer withOptions:(HmsScanOptions *)options];
获取图片image,传入算法获取多码解码结果数组。请参见相机扫码。
Declaration
+ (NSArray *)multiDecodeBitMapForImage:(UIImage *)image withOptions:(HmsScanOptions *)options
调用示例:
[bitMap multiDecodeBitMapForImage:(UIImage *)image withOptions:(HmsScanOptions *)options];
获取图片帧sampleBuffer,传入算法获取多码解码结果数组。请参见相机扫码。
Declaration
+(NSArray *)multiDecodeBitMapForSampleBuffer:(CMSampleBufferRef)sampleBuffer withOptions:(HmsScanOptions *)options
调用示例:
[bitMap multiDecodeBitMapForSampleBuffer:(CMSampleBufferRef)sampleBuffer withOptions:(HmsScanOptions *)options];
获取图片image,传入算法获取单码解码结果。
NSDictionary *dic = [HmsBitMap bitMapForImage:image withOptions:[[HmsScanOptions alloc] initWithScanFormatType:ALL]];
获取图片image,传入算法获取多码解码结果数组。
NSArray *list = [HmsBitMap multiDecodeBitMapForImage:image withOptions:[[HmsScanOptions alloc] initWithScanFormatType:ALL]];
AVCaptureSession
-(void)captureOutput:(AVCaptureOutput *)output didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
NSDictionary *dic = [HmsBitMap bitMapForSampleBuffer:sampleBuffer withOptions:[[HmsScanOptions alloc] initWithScanFormatType:ALL]];
NSArray *list = [HmsBitMap multiDecodeBitMapForSampleBuffer:sampleBuffer withOptions:[[HmsScanOptions alloc] initWithScanFormatType:ALL]];
Name | Description |
|---|---|
image | 图片扫码下待解码的图片,为保证解码效果最佳,建议图片分辨率为960px*540px ~ 1920px*1080px,图片大小不要超过50M。 |
sampleBuffer | 相机扫码下待解码的视频帧。 |
[[HmsScanOptions alloc] initWithScanFormatType:All] | 指定的扫码格式。 |
Returns
Type | Description |
|---|---|
NSDictionary(单码) | 扫码方式中扫码结果的回调NSDictionary数据,包含以下内容:
|
NSArray(多码) | 扫码方式中扫码结果的回调NSArray数据,数组内包含一个或多个NSDictionary,NSDictionary内数据与单码相同。 |