EFPrefix / EFQRCode

A better way to operate QR Code in Swift, support iOS, macOS, watchOS and tvOS.
https://efprefix.github.io/EFQRCode
MIT License
4.57k stars 481 forks source link

Question about QRCodeRecognize #149

Open HIIgor opened 2 years ago

HIIgor commented 2 years ago

你好,最近在做识别二维码的功能,看到EFQRCode识别这块的逻辑有2个疑问.

为什么 CIDetectorAccuracyLow 低精度的识别要放到高精度的后面呢,我理解低精度的速度较快,高精度应该做兜底.

另外一个疑问是 取得图片的灰度这块是必须的吗

private func getQRString() -> [String] {
    let result = image.ciImage().recognizeQRCode(
        options: [CIDetectorAccuracy: CIDetectorAccuracyHigh]
    )
    if result.isEmpty, let grayscaleImage = image.grayscale {
        return grayscaleImage.ciImage().recognizeQRCode(
            options: [CIDetectorAccuracy: CIDetectorAccuracyLow]
        )
    }
    return result
}
ZYHshao commented 5 months ago

me too...