Barcode scanning utility class that supports barcode scanning in Bitmap mode.
Declaration
@interface HmsBitMap : NSObject
Initialization method.
HmsBitMap *bitMap = [[HmsBitMap alloc] init];
Obtains the decoding result for a single barcode based on the input image parameter and algorithm. For details, please refer to Image Mode.
Declaration
+(NSDictionary *)bitMapForImage:(UIImage *)image withOptions:(HmsScanOptions *)options
Example:
[bitMap bitMapForImage:(UIImage *)image withOptions:(HmsScanOptions *)options];
Obtains the decoding result for a single barcode based on the input sampleBuffer parameter and algorithm. For details, please refer to Image Mode.
Declaration
+(NSDictionary *)bitMapForSampleBuffer:(CMSampleBufferRef)sampleBuffer withOptions:(HmsScanOptions *)options
Example:
[bitMap bitMapForSampleBuffer:(CMSampleBufferRef)sampleBuffer withOptions:(HmsScanOptions *)options];
Obtains the decoding result for multiple barcodes based on the input image parameter and algorithm. For details, please refer to Camera Mode.
Declaration
+ (NSArray *)multiDecodeBitMapForImage:(UIImage *)image withOptions:(HmsScanOptions *)options
Example:
[bitMap multiDecodeBitMapForImage:(UIImage *)image withOptions:(HmsScanOptions *)options];
Obtains the decoding result for multiple barcodes based on the input sampleBuffer parameter and algorithm. For details, please refer to Camera Mode.
Declaration
+(NSArray *)multiDecodeBitMapForSampleBuffer:(CMSampleBufferRef)sampleBuffer withOptions:(HmsScanOptions *)options
Example:
[bitMap multiDecodeBitMapForSampleBuffer:(CMSampleBufferRef)sampleBuffer withOptions:(HmsScanOptions *)options];
Obtains the decoding result for a single barcode based on the input image parameter and algorithm.
NSDictionary *dic = [HmsBitMap bitMapForImage:image withOptions:[[HmsScanOptions alloc] initWithScanFormatType:ALL]];
Obtains the decoding result for multiple barcodes based on the input image parameter and algorithm.
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 | Image to be decoded. For optimal effect, it is recommended that the image dimensions range from 960 x 540 px to 1920 x 1080 px, with a maximum file size of 50 MB. |
sampleBuffer | Video frame to be decoded. |
[[HmsScanOptions alloc] initWithScanFormatType:All] | Specified barcode format. |
Returns
Type | Description |
|---|---|
NSDictionary (single barcode) | NSDictionary class that contains scanning result data, including:
|
NSArray (multiple barcodes) | NSArray class that contains one or more NSDictionary classes. Under the multi-barcode scenario, the data in each NSDictionary class is the same as that in the NSDictionary class under the single barcode scenario. |