【问题标题】:iOS get message string from one-dimensional imageiOS从一维图像中获取消息字符串
【发布时间】:2017-02-22 06:32:06
【问题描述】:

我可以获取带有二维条码图像的字符串消息,并使用输入字符串生成二维条码图像,但是如何获取带有一维条码的字符串消息以及如何生成带有字符串的字符串消息?下面的代码是关于二维条码的:

+ (NSString *)decodeImage:(CIImage *)ciImage {
    NSDictionary *options = @{CIDetectorAccuracy : CIDetectorAccuracyHigh};
    CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:nil options:options];
    NSArray *features = [detector featuresInImage:ciImage];
    for (CIFeature *feature in features) {
        if ([feature isKindOfClass:[CIQRCodeFeature class]]) {
            CIQRCodeFeature *qrFeature = (CIQRCodeFeature *)feature;
            return qrFeature.messageString;
        }
    }
    return nil;
}

....

一维条码呢?

【问题讨论】:

    标签: ios barcode


    【解决方案1】:

    您使用的系统未检测到您要查找的条形码类型。

    但您可以使用不同的系统来检测更多种类的代码。查看AVCaptureSession 中使用的AVCaptureMetadataOutput

    有关其工作原理的摘要,请参阅https://ayeohyes.wordpress.com/2015/05/09/barcode-scanning-in-ios-using-avfoundation/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-25
      • 1970-01-01
      • 1970-01-01
      • 2019-05-11
      • 2016-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多