iOS原生二维码扫描(二)

本文介绍如何优化iOS原生二维码扫描的识别区域,以解决全屏扫描时在屏幕边界容易误识别的问题。通过设置AVCaptureMetadataOutput的rectOfInterest属性,调整识别区域大小,并注意在横屏坐标系下正确设置该属性。同时,文章提到了界面扫描动画的实现及可能添加的闪光灯功能,以提升用户体验。
摘要由CSDN通过智能技术生成


由于原生的二维码扫描,响应速度特别快,全屏扫描区域的话会出现二维码图像在屏幕边界的时候就会识别,影响使用体验,所以要更改一下识别区域的大小

输出流AVCaptureMetadata有这么一个属性rectOfInterest 就是它的识别区域大小属性,这是它的描述:

/*!

 @property rectOfInterest

 @abstract

    Specifies a rectangle of interest for limiting the search area for visual metadata.

 

 @discussion

    The value of this property is a CGRect that determines the receiver's rectangle of interest for each frame of video. The rectangle's origin is top left and is relative to the coordinate space of the device providing the metadata. Specifying a rectOfInterest may improve detection performance for certain types of metadata.The default value of this property is the value CGRectMake(0, 0, 1, 1). Metadata objects whose bounds do not intersect with the rectOfInterest will not be returned.

 */

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值