While doing some image processing I am also trying to detect QR codes from
an image buffer.
The following code works just fine

    func captureOutput(_ captureOutput: AVCaptureOutput,
didOutputSampleBuffer sampleBuffer: CMSampleBuffer, from connection:
AVCaptureConnection) {

        if !CMSampleBufferIsValid(sampleBuffer) {
            return
        }

        let pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)! as
CVPixelBuffer
        var image = CIImage(cvPixelBuffer: pixelBuffer)

        ...

        let qrFeatures = qrDetector?.features(in: CIImage(cvImageBuffer:
pixelBuffer))
        print("qr", qrFeatures ?? "nil")

        if let previewView = self.previewView {
            previewView.image = image
        }
    }


but the QR code detector is producing a warning and spamming the console.

  Finalizing CVPixelBuffer 0x17412f500 while lock count is 1.
  qr []
  Finalizing CVPixelBuffer 0x17012ed80 while lock count is 1.
  qr []
  Finalizing CVPixelBuffer 0x17012ed80 while lock count is 1.
  qr []

>From this stackoverflow post it sounds like that's a iOS10 bug.


http://stackoverflow.com/questions/35956538/how-to-read-qr-code-from-static-image/35957461

Has anyone come across this before?

It sounds like an imbalance
of CVPixelBufferLockBaseAddress/CVPixelBufferUnlockBaseAddress calls. But
calling CVPixelBufferUnlockBaseAddress myself didn't help either.

Any thoughts on fixing this?

cheers,
Torsten
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to