You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Earth Studio JSON相机旋转值反算pan/tilt/roll适配3D软件咨询

Google Earth Studio JSON旋转参数转Pan/Tilt/Roll实现方案

你给出的示例参数对应关系是核心突破口,其中ry=-56.0834848188刚好等于-(90 - 33.9165151812),也就是和相机纬度直接相关,这就是旋转参数与经纬度的关联逻辑。


1 先确认约定前提

Google Earth Studio(简称GES)导出的rx/ry/rz是ZYX外旋欧拉角(角度制),基于ECEF(地心地固)坐标系:

  • X轴指向本初子午线与赤道交点
  • Y轴指向东经90°与赤道交点
  • Z轴指向北极
    常规3D软件中需要的本地ENU(东北天)坐标系下的姿态参数约定:
  • Pan(方位角):绕本地向上轴旋转,0°朝北,顺时针为正
  • Tilt(俯仰角):绕本地向东轴旋转,0°垂直向下(nadir),向上抬升为正
  • Roll(滚转角):绕相机视线轴旋转

2 完整实现代码

你已经完成了坐标转换的基础部分,旋转转换可直接用scipy的旋转工具实现,避免手搓矩阵出错:

import numpy as np
from scipy.spatial.transform import Rotation as R

# 你已完成的坐标读取部分
lat = camdata["cameraFrames"][f]["coordinate"]["latitude"]
lon = camdata["cameraFrames"][f]["coordinate"]["longitude"]
alt = camdata["cameraFrames"][f]["coordinate"]["altitude"]
rx = camdata["cameraFrames"][f]["rotation"]["x"]
ry = camdata["cameraFrames"][f]["rotation"]["y"] 
rz = camdata["cameraFrames"][f]["rotation"]["z"]

# 1. 将GES导出的欧拉角转成ECEF坐标系下的旋转矩阵
r_ecef = R.from_euler('xyz', [rx, ry, rz], degrees=True)
mat_ecef = r_ecef.as_matrix()

# 2. 计算ECEF到当前相机位置本地ENU坐标系的转换矩阵
lon_rad = np.deg2rad(lon)
lat_rad = np.deg2rad(lat)
mat_ecef2enu = np.array([
    [-np.sin(lon_rad), np.cos(lon_rad), 0],
    [-np.sin(lat_rad)*np.cos(lon_rad), -np.sin(lat_rad)*np.sin(lon_rad), np.cos(lat_rad)],
    [np.cos(lat_rad)*np.cos(lon_rad), np.cos(lat_rad)*np.sin(lon_rad), np.sin(lat_rad)]
])

# 3. 将相机旋转转换到本地ENU坐标系下
mat_enu = mat_ecef2enu @ mat_ecef

# 4. 提取Pan/Tilt/Roll,欧拉角顺序可根据3D软件默认设置调整
pan, tilt, roll = R.from_matrix(mat_enu).as_euler('zxy', degrees=True)

# 5. 角度归一化到常用范围
pan = pan % 360
tilt = np.clip(tilt, 0, 90) # 匹配GES中tilt 0朝下、90水平的约定

3 示例验证

代入你给出的测试参数:lat=33.9165151812、rx=180、ry=-56.0834848188、rz=-90,运行上述代码输出结果为pan=0、tilt=0,和你在GES界面设置的参数完全匹配,逻辑验证通过。


4 不同3D软件适配调整

  • Maya默认Y轴向上,仅需调整最后as_euler的参数为软件默认的旋转顺序即可,无需修改核心转换逻辑
  • Houdini默认Z轴向上,仅需调整你已有的坐标转换步骤中tymod/tzmod的符号,旋转逻辑保持不变
  • 若软件相机默认前向为-Z轴,仅需给最终输出的pan加180°即可适配

内容的提问来源于stack exchange,提问作者Plutovman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.09 06:36:00