Forum

Author Topic: .path encoding files  (Read 2775 times)

GGR

  • Newbie
  • *
  • Posts: 30
    • View Profile
.path encoding files
« on: October 15, 2019, 02:53:09 PM »
Hello everyone,

Does anyone know to which value refere the four last columns of an export in .path format ? As attachement, you'll find a example of my auto-generated track (I kept the 10 firsts entries).

Is it kind of a translation of the yaw/pitch/roll or kappa/phi/omega format ? And if it is, do you know the way to convert those values ?

Thanks by advance
Gabriel
Best regards
Gabriel

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: .path encoding files
« Reply #1 on: October 15, 2019, 06:21:22 PM »
Hello GGR,

The last four columns in the .path file contain the elements of the quaternion that defines the orientation of the camera.

If you need the rotational part be converted to OPK or YPR representation, you may need a Python file (which would access Keyframe elements from all the cameras of the project).
I think in the 1.6.0 release (maybe earlier) it would be also possible to copy the contents of the Animation pane (with coordinates and rotation angles) in the selected convention.
Best regards,
Alexey Pasumansky,
Agisoft LLC

GGR

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: .path encoding files
« Reply #2 on: October 16, 2019, 11:42:17 AM »
Hey Alexey,

If I get it right, I've to find my way to convert those values in OPK or YPR ?

By the way, the process you talk about isn't available in the 1.6.0 prerelease build 9063, the one I use, neither on the metashape changelog.

I hope it wild possible to get it. It should be a way to create drone tracks in kml quite easily.

Cheers
Best regards
Gabriel

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: .path encoding files
« Reply #3 on: October 17, 2019, 05:18:55 PM »
Hello GGR,

If you run Plan Mission operation on georeferneced chunk, then the generated camera track could be exported to KML format and be used with drone controlling application (sequence of shooting points and camera orientation of them will be kept).

At the moment there is no possibility to create the KML-exportable track from scratch of from automatic tracks. If necessary, I can post a script that will print out (or export as a text) the location information and orientation angles for the key frames in the active camera track, like it is shown in the Animation pane table.
Best regards,
Alexey Pasumansky,
Agisoft LLC

GGR

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: .path encoding files
« Reply #4 on: October 18, 2019, 12:48:11 PM »
Hello Alexey,

Regarding the plan mission, I'll post few observations in an other topic. But it indeed it should be a way to get what I want.

About your proposal of a script to export the datas like they appaer in the animation pane, if you've something like this it would be nice.

Thanks
Gabriel
Best regards
Gabriel

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: .path encoding files
« Reply #5 on: October 18, 2019, 03:19:56 PM »
Hello Gabriel,

The following script will print out the information on keyframes from the active chunk's camera track (id, x, y, z, yaw, pitch, roll):
Code: [Select]
T = chunk.transform.matrix
crs = chunk.crs

for camera in chunk.camera_track.keyframes:
    coord = crs.project(T.mulp(camera.center))
   

    m = crs.localframe(T.mulp(camera.center))
    R = (m * T * camera.transform * Metashape.Matrix().Diag([1, -1, -1, 1])).rotation()
    ypr = Metashape.utils.mat2ypr(R)

    output = "{:d},{:.6f},{:.6f},{:.3f},{:.3f},{:.3f},{:.3f}\n".format(camera.key, coord.x, coord.y, coord.z, ypr.x, ypr.y, ypr.z)
    print(output)
If necessary, you can redirect it to the file.
Best regards,
Alexey Pasumansky,
Agisoft LLC

GGR

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: .path encoding files
« Reply #6 on: October 18, 2019, 03:21:28 PM »
Thank you very much, I'm gonna try this !
Best regards
Gabriel