How do I use the metadataOutputRectOfInterestForRect method and rectOfInterest property to scan a specific area? (QR Code)

前端 未结 8 1953
时光说笑
时光说笑 2020-12-04 18:00

I am building a QR code scanner with Swift and everything works in that regard. The issue I have is that I am trying to make only a small area of the entire visible A

8条回答
  •  温柔的废话
    2020-12-04 18:52

    Swift 4:

    captureSession?.startRunning()
    let scanRect = CGRect(x: 0, y: 0, width: 100, height: 100)
    let rectOfInterest = layer.metadataOutputRectConverted(fromLayerRect: scanRect)
    metaDataOutput.rectOfInterest = rectOfInterest
    

提交回复
热议问题