converting Agisoft Metashape lens calibration files to the ASP .tsai

21 views
Skip to first unread message

Michael Studinger

unread,
Apr 7, 2024, 10:00:12 PMApr 7
to Ames Stereo Pipeline Support
Hi everyone,

before I ask my question let me first thank the ASP team (Oleg!) for the amazing support on this channel and a superb user manual that comes with ASP. Great job!

A colleague and I am working on converting Agisoft Metashape lens calibration files to the ASP .tsai PINHOLE/TSAI format. The Agisoft lens calibration files contain three radial distortion parameters (k1,k2,k3) and the ASP manual lists the AdjustableTSAI format for using Agisoft Metashape lens calibration parameters:

AdjustableTSAI
Radial Coeff: Vector3(1.31024e-04, 1.31024e-07, 1.31024e-08)
Tangential Coeff: Vector2(-2.05354e-07, 1.05354e-07)
Alpha: 0.4


I have copy/pasted the above into a .tsai file in the second part of the .tsai file but ASP can't ingest the format. Any pointers what I am doing wrong?

ASP does not seem to mind an additional k3 parameter in a TSAI format file, but I am guessing k3 is not being used to calculate the lens distortion. This file, including k3, ingests without issues:

VERSION_4
PINHOLE
fu = 5227.633227844355
fv = 5227.633227844355
cu = 2459.238704269580
cv = 1622.801130607475
u_direction = 1  0  0
v_direction = 0  1  0
w_direction = 0  0  1
C = 0 0 0
R = 1 0 0 0 1 0 0 0 1
pitch = 1.0
TSAI
k1 =   -0.094196634563
k2 =    0.115036424262
k3 =   -0.032238313341
p1 =   -0.000256622541
p2 =   -0.000353613460

Does anyone have an example .tsai file in AdjustableTSAI format that I can use as a template?
Thanks for any help,

Michael

Alexandrov, Oleg (ARC-TI)[KBR Wyle Services, LLC]

unread,
Apr 7, 2024, 11:39:46 PMApr 7
to Michael Studinger, Ames Stereo Pipeline Support
Michael,

I don't know how easy is to convert Metashape lens calibration files to ASP's ones. Could be possible, but I never tried. Can try to talk about that in more detail offline. 

To address you immediate issue, here's an adjustable tsai file that works for me:

VERSION_3
fu = 2.7972434018886133
fv = 2.7972434018886133
cu = 2.0804211742736006
cv = 1.040347088449553
u_direction = 1 0 0
v_direction = 0 1 0
w_direction = 0 0 1
C = -1935200.2981592226 -1247482.848182166 6115499.7869778136
R = -0.93368489757983908 -0.2046650229694324 0.29384475561807771 -0.15162826435410026 0.96934084312936153 0.19335769777855261 -0.32440928081713255 0.13597999196271743 -0.93609190804403952
pitch = 0.001
AdjustableTSAI
Radial Coeff: Vector3(1.31024e-04, 1.31024e-05, 1.31024e-05)
Tangential Coeff: Vector2(-2.05354e-05, 1.05354e-05)
Alpha: 0.4

What you have is fine though, but maybe something is different in the first part.

> ASP does not seem to mind an additional k3 parameter in a TSAI format file, but I am guessing k3 is not being used to calculate the lens distortion. This file, including k3, ingests without issues:


In the very latest builds I made some changes.
k3 is used if provided, and not used if not. Before that, likely k3 was ignored or it would have thrown an error, not sure.

Oleg


From: ames-stereo-pi...@googlegroups.com <ames-stereo-pi...@googlegroups.com> on behalf of Michael Studinger <michael....@gmail.com>
Sent: Sunday, April 7, 2024 7:00 PM
To: Ames Stereo Pipeline Support <ames-stereo-pi...@googlegroups.com>
Subject: [EXTERNAL] [BULK] converting Agisoft Metashape lens calibration files to the ASP .tsai
 
CAUTION: This email originated from outside of NASA.  Please take care when clicking links or opening attachments.  Use the "Report Message" button to report suspicious messages to the NASA SOC.
Reply all
Reply to author
Forward
0 new messages