ARKit 的相机 space 的方向是什么?
What is the orientation of ARKit's camera space?
我想更好地理解 ARKit 的 ARCamera 变换所在的相机坐标 space。In the documentation,它说
This transform creates a local coordinate space for the camera that is constant with respect to device orientation. In camera space, the x-axis points to the right when the device is in UIDeviceOrientation.landscapeRight orientation—that is, the x-axis always points along the long axis of the device, from the front-facing camera toward the Home button. The y-axis points upward (with respect to UIDeviceOrientation.landscapeRight orientation), and the z-axis points away from the device on the screen side.
在此之后,the UIDeviceOrientation.landscapeRight documentation 说:
The device is in landscape mode, with the device held upright and the
home button on the left side.
当我试图理解这一点时,"the x-axis points to the right when the device is in UIDeviceOrientation.landscapeRight orientation"
和 "that is, the x-axis always points along the long axis of the device, from the front-facing camera toward the Home button"
之间似乎存在冲突。前者右边有+x,后者左边有+x。
这是我的图片 "the x-axis points to the right when the device is in UIDeviceOrientation.landscapeRight orientation"
:
这就是我想象的样子 "that is, the x-axis always points along the long axis of the device, from the front-facing camera toward the Home button"
:
感谢任何帮助,谢谢!
更新:它不影响这个问题,但为了更清楚,我问这个的原因是因为我有兴趣从 [=21= 获取 x、y 和 z 地磁数据值].在 Core Location 中,如果 phone 处于纵向模式,+x 向右,+y 向上,+z 朝向用户。因此,ARKit 的相机坐标系似乎与 Core Location 中的相机坐标系不同。
让我们先解决一件事,landscapeRight
的主页按钮在右侧,phone 的顶部在左侧,这与您在图片。因此,在您的绘图中,phone 应该翻转 180 度。 landscapeRight
在这种情况下与设备方向不同
首先,您的 Arkit 会话的坐标系将取决于 world alignment setting of your AR session
所以你有三个选择
Gravity
- 在这种情况下,无论设备的方向如何,Y 都会指向上方,与重力平行
For the z-axis, ARKit chooses a basis vector (0,0,-1) pointing in the direction the device camera faces and perpendicular to the gravity axis
据此,z轴将指向摄像头朝向的方向(因此对于前置摄像头,z轴将指向屏幕,对于后置摄像头,z轴将离开 phone 并远离你)
然后用右手法则确定X轴
Gravity and Heading
- y 轴将指向平行于重力的方向
- z 轴将指向南方(-z 将指向真北)
- x 轴将指向东方
Camera
在这种情况下,相机将始终位于您的世界坐标中的 (0,0,0) space
y 轴将指向上方(如果您的 phone 处于纵向模式,则指向右侧),x 轴将从 phone 的顶部指向主页按钮,而 z 轴将指向远离设备
好的,正如@Mart10 正确指出的那样,我最初的图表是不正确的。 ARKit Camera 上下文中的 Landscape right 表示 phone 在横向中,主页按钮在右侧。 对此进行了更详细的解释。
这意味着相机坐标系惯例是,当在右侧的主页按钮横向时:+x:向右,+y:向上,+z:向后。
这与 "sensor coordinate system" 不同,"sensor coordinate system" 是 x, y, and z geomagnetic data values from Core Location 使用的坐标系。 "sensor coordinate system" 是横向显示时,主页按钮在右侧:+x:向上,+y:向左,+z:向后。您可以使用变换在它们之间切换。
我想更好地理解 ARKit 的 ARCamera 变换所在的相机坐标 space。In the documentation,它说
This transform creates a local coordinate space for the camera that is constant with respect to device orientation. In camera space, the x-axis points to the right when the device is in UIDeviceOrientation.landscapeRight orientation—that is, the x-axis always points along the long axis of the device, from the front-facing camera toward the Home button. The y-axis points upward (with respect to UIDeviceOrientation.landscapeRight orientation), and the z-axis points away from the device on the screen side.
在此之后,the UIDeviceOrientation.landscapeRight documentation 说:
The device is in landscape mode, with the device held upright and the home button on the left side.
当我试图理解这一点时,"the x-axis points to the right when the device is in UIDeviceOrientation.landscapeRight orientation"
和 "that is, the x-axis always points along the long axis of the device, from the front-facing camera toward the Home button"
之间似乎存在冲突。前者右边有+x,后者左边有+x。
这是我的图片 "the x-axis points to the right when the device is in UIDeviceOrientation.landscapeRight orientation"
:
这就是我想象的样子 "that is, the x-axis always points along the long axis of the device, from the front-facing camera toward the Home button"
:
感谢任何帮助,谢谢!
更新:它不影响这个问题,但为了更清楚,我问这个的原因是因为我有兴趣从 [=21= 获取 x、y 和 z 地磁数据值].在 Core Location 中,如果 phone 处于纵向模式,+x 向右,+y 向上,+z 朝向用户。因此,ARKit 的相机坐标系似乎与 Core Location 中的相机坐标系不同。
让我们先解决一件事,landscapeRight
的主页按钮在右侧,phone 的顶部在左侧,这与您在图片。因此,在您的绘图中,phone 应该翻转 180 度。 landscapeRight
在这种情况下与设备方向不同
首先,您的 Arkit 会话的坐标系将取决于 world alignment setting of your AR session
所以你有三个选择
Gravity
- 在这种情况下,无论设备的方向如何,Y 都会指向上方,与重力平行
For the z-axis, ARKit chooses a basis vector (0,0,-1) pointing in the direction the device camera faces and perpendicular to the gravity axis
据此,z轴将指向摄像头朝向的方向(因此对于前置摄像头,z轴将指向屏幕,对于后置摄像头,z轴将离开 phone 并远离你)
然后用右手法则确定X轴
Gravity and Heading
- y 轴将指向平行于重力的方向
- z 轴将指向南方(-z 将指向真北)
- x 轴将指向东方
Camera
在这种情况下,相机将始终位于您的世界坐标中的 (0,0,0) space y 轴将指向上方(如果您的 phone 处于纵向模式,则指向右侧),x 轴将从 phone 的顶部指向主页按钮,而 z 轴将指向远离设备
好的,正如@Mart10 正确指出的那样,我最初的图表是不正确的。 ARKit Camera 上下文中的 Landscape right 表示 phone 在横向中,主页按钮在右侧。
这意味着相机坐标系惯例是,当在右侧的主页按钮横向时:+x:向右,+y:向上,+z:向后。
这与 "sensor coordinate system" 不同,"sensor coordinate system" 是 x, y, and z geomagnetic data values from Core Location 使用的坐标系。 "sensor coordinate system" 是横向显示时,主页按钮在右侧:+x:向上,+y:向左,+z:向后。您可以使用变换在它们之间切换。