谷歌地球工作室的摄像机数据

2024-10-04 03:25:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用JSON格式从Google Earth Studio导出数据。我想将这些数据导入3D应用程序,如maya或houdini。我的问题是关于摄像机方位的。我似乎无法将JSON文件中看到的相机xyz旋转数据与我在Google Earth Studio中设置的平移-倾斜值进行对比。例如,在界面中,以下是摄像头设置:

cam lon= 0
cam lat= 33.9165151812 
cam alt = 1725 m
cam pan = 0  (looking straight)
cam tilt = 0 (pointing nadir)

将转换为以下旋转向量:

rx=180 | ry=-56.0834848188 | rz=-89.9999999998

注意,我正在使用python来解释这些数据。理想情况下,我希望对这些rx、ry、rz角度进行反向工程,以获得可以在3d软件中使用的平移/倾斜/滚动值

如果您有任何建议,我们将不胜感激。以下是我迄今为止所做工作的概要:

lat = camdata["cameraFrames"][f]["coordinate"]["latitude"]
lon = camdata["cameraFrames"][f]["coordinate"]["longitude"]
alt = camdata["cameraFrames"][f]["coordinate"]["altitude"]

xEcef,yEcef,zEcef = geodetic_to_ecef(lat, lon, alt)  # get earth-centered, earth-fixed coords
xEast, yNorth, zUp = ecef_to_enu(xEcef,yEcef,zEcef,lat0,lon0,alt0) # get local east, north up coords relative to a reference lat0,lon0,alt0

 # express in y-up coords
 txmod = xEast
 tzmod = -yNorth
 tymod = zUp

 rx = camdata["cameraFrames"][f]["rotation"]["x"]
 ry = camdata["cameraFrames"][f]["rotation"]["y"] 
 rz = camdata["cameraFrames"][f]["rotation"]["z"]

 # now I have to use these rotations in conjunction with the camera's lat,lon, alt
 # to get back pan/tilt/roll values

Tags: to数据coordinategetcoordsaltrxlon