Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QR code ios 7 AVMetadataObject

I Have problem with detect where is qr code.

I need draw border around it.

I use AVMetadataObject bezierpath, but it dont work.

Please help me.

- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputMetadataObjects:(NSArray *)metadataObjects
       fromConnection:(AVCaptureConnection *)connection
{
    for (AVMetadataObject *metadata in metadataObjects)
    {
            AnimationView *cv = [[AnimationView alloc]initWithFrame:self.livevideo.bounds]; //creat an instance of your custom view
        [cv setBackgroundColor:[UIColor clearColor]];



        NSLog(@"%f",metadata.accessibilityPath.accessibilityActivationPoint.x);

        [location addSubview:cv];


        if ([metadata.type isEqualToString:AVMetadataObjectTypeEAN13Code])
        {

        }
        else if ([metadata.type isEqualToString:AVMetadataObjectTypeUPCECode])
        {

        }
        else if ([metadata.type isEqualToString:AVMetadataObjectTypeEAN8Code])
        {

        }
        else if ([metadata.type isEqualToString:AVMetadataObjectTypeQRCode])
        {

        }
    }
}
like image 260
Unmerciful Avatar asked Apr 30 '26 13:04

Unmerciful


1 Answers

You will need to use the corners property from AVMetadataMachineReadableCodeObject to draw a perspective box around the detected code.

See my example at https://github.com/werner77/WECodeScanner

like image 100
Werner Altewischer Avatar answered May 02 '26 05:05

Werner Altewischer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!