[Python] camera data from google earth studio

Discussão em 'Python' iniciado por Stack, Julho 11, 2025.

  1. Stack

    Stack Membro Participativo

    I'm exporting data out of Google Earth Studio using the JSON format. I would like to import this data into a 3D app, like maya or houdini. The question I have is specifically about camera orientation. I can't seem to corelate the camera xyz rotation data I see in the JSON file to the pan tilt values that I set in Google Earth Studio. For instance from the interface, here are the camera settings:

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


    That gets turned into the following rotation vector:

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


    Note I'm using python do interpret this data. Ideally, I'd like to reverse-engineer these rx,ry,rz angles to get back pan/tilt/roll values that I can then use in my 3d software.

    Any tips you might have would be appreciated. Below is an outline of what I've done so far:

    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

    Continue reading...

Compartilhe esta Página