本文介绍了ios视觉VNImageRequestHandler方向问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 VNImageRequestHandler (iOS Vision)通过相机检测面部.当我在横向模式下用相机指向照片时,它会检测到人脸,但方向相反.

I am trying to detect faces via camera using VNImageRequestHandler (iOS Vision).When I point on the photo by the camera in landscape mode it detects faces but with opposite orientation mode.

  let detectFaceRequestHandler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer, options: [:])

推荐答案

您是否尝试过使用 VNImageRequestHandler orientation 属性?

Have you tried to play with the VNImageRequestHandler orientation property?

let imageRequestHandler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer, orientation: .right, options: [:])

在以纵向模式读取来自后置摄像头的视频输入时,我必须将其设置为 .right .

I had to set it to .right while reading video input from back camera in portrait mode.

这篇关于ios视觉VNImageRequestHandler方向问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 19:15