ARKit:再现项目点功能 [英] ARKit: Reproducing the Project Point function

查看:24
本文介绍了ARKit:再现项目点功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试重现 ARCamera 的项目点函数,但由于某种原因,这些值没有正确匹配.我正在使用 ARCamera 的投影矩阵和视图矩阵,并应用基本的 CG 透视变换数学,(PV) * p,但 NDC 值与 ARCamera 的项目点函数给出的像素值不匹配.有任何想法吗?我是不是忘记了什么?

I'm attempting to reproduce the ARCamera's project point function, but for some reason the values are not matching up properly. I am taking the ARCamera's projection matrix and view matrix and applying basic CG perspective transform math, (PV) * p, but the NDC values do not match the pixel values given from the ARCamera's project point function. Any ideas? Am I forgetting something?

更多细节:

基本上,我试图通过单击按钮来获取 ARFrame,然后尝试复制 https://developer.apple.com/documentation/arkit/arcamera/2923538-projectpoint.我正在尝试使用 https://developer.apple.com/文档/arkit/arcamera/2887458-projectionmatrixhttps://developer.apple.com/documentation/arkit/arcamera/2921672-viewmatrix,确保两个部分的所有输入都匹配.CG尺寸用于将坐标从NDC空间转换到图像空间.

Basically, I'm trying to take an ARFrame a the click of a button, and then trying to replicate the functionality of https://developer.apple.com/documentation/arkit/arcamera/2923538-projectpoint. I'm attempting to do this with https://developer.apple.com/documentation/arkit/arcamera/2887458-projectionmatrix and https://developer.apple.com/documentation/arkit/arcamera/2921672-viewmatrix, making sure all of the inputs match for both parts. CG size is used to transform the coordinates from NDC space to image space.

找到解决方案,查看下面的评论.

Solution found, check comments below.

推荐答案

问题原来是projection_matrix 有时无法正确找到设备方向.正确的方法是使用 projectionMatrix(for:viewportSize:zNear:zFar:).

The problem turned out to be projection_matrix sometimes does not correctly find the device orientation. The correct approach is to use projectionMatrix(for:viewportSize:zNear:zFar:).

这篇关于ARKit:再现项目点功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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