如何在iOS上获取相机校准数据?又名AVCameraCalibrationData [英] How can I get Camera Calibration Data on iOS? aka AVCameraCalibrationData

查看:106
本文介绍了如何在iOS上获取相机校准数据?又名AVCameraCalibrationData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,AVCameraCalibrationData仅在AVCaptureDepthDataOutput上可用.正确吗?

As I understand it, AVCameraCalibrationData is only available over AVCaptureDepthDataOutput. Is that correct?

另一方面,AVCaptureDepthDataOutput仅可用于iPhone X前摄像头或iPhone Plus后摄像头,还是我弄错了?

AVCaptureDepthDataOutput on the other hand is only accessible with iPhone X front cam or iPhone Plus back cam, or am I mistaken?

我想做的是获取AVCaptureVideoDataOutput SampleBuffer的FOV.特别是,它应该与所选的预设(全高清,照片等)匹配.

What I am trying to do is to get the FOV of an AVCaptureVideoDataOutput SampleBuffer. Especially, it should match the selected preset (full HD, Photo etc.).

推荐答案

您只能从深度数据输出或照片输出中获取AVCameraCalibrationData.

You can get AVCameraCalibrationData only from depth data output or photo output.

但是,如果您只需要FOV,则只需要该类提供的部分信息-相机内在矩阵 —您可以从AVCaptureVideoDataOutput本身获取它.

However, if all you need is FOV, you need only part of the info that class offers — the camera intrinsics matrix — and you can get that by itself from AVCaptureVideoDataOutput.

  1. cameraIntrinsicMatrixDeliveryEnabled >将相机设备连接到捕获会话. (请注意,您应该首先检查 cameraIntrinsicMatrixDeliverySupported ;并非所有捕获格式支持内在函数.)

  1. Set cameraIntrinsicMatrixDeliveryEnabled on the AVCaptureConnection connecting your camera device to the capture session. (Note you should check cameraIntrinsicMatrixDeliverySupported first; not all capture formats support intrinsics.)

当视频输出出售示例缓冲区时,请检查每个示例缓冲区的附件中的kCMSampleBufferAttachmentKey_CameraIntrinsicMatrix键.如CMSampleBuffer.h中所述(有人应提交雷达关于将此信息纳入在线文档),该值对于该附件,是一个CFData编码为matrix_float3x3,并且该矩阵的(0,0)和(1,1)元素是水平和垂直焦距(以像素为单位).

When the video output vends sample buffers, check each sample buffer's attachments for the kCMSampleBufferAttachmentKey_CameraIntrinsicMatrix key. As noted in CMSampleBuffer.h (someone should file a radar about getting this info into the online documentation), the value for that attachment is a CFData encoding a matrix_float3x3, and the (0,0) and (1,1) elements of that matrix are the horizontal and vertical focal length in pixels.

这篇关于如何在iOS上获取相机校准数据?又名AVCameraCalibrationData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆