Forum

Author Topic: The Command "importReference"  (Read 4020 times)

Mojtaba Goudarzi

  • Newbie
  • *
  • Posts: 6
    • View Profile
The Command "importReference"
« on: May 04, 2023, 12:11:23 PM »
Hello everyone,
I have written the following Python program to add images and import reference. By running the program, images are added, but the reference is not imported. Can you guide me what the problem is?
In addition, the command "importReference" is not clear to me. Using this command, how does the computer find out, for example, which reference column the "Altitude" factor corresponds to?

import os, Metashape
doc = Metashape.app.document
chunk = doc.addChunk()
Pfad1 = "C:/Users/Desktop/TIFF"
Liste = os.listdir(Pfad1)
Fotos = list()
for Foto in Liste:
    Fotos.append("/".join([Pfad1, Foto]))
chunk.addPhotos(Fotos)
Pfad2 = "C:/Users/Desktop/Referenz.csv"
chunk.importReference(Pfad2, delimiter = ';', columns = 'nxyz', skip_rows = 1)

Best Regards,
Mojtaba Goudarzi

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: The Command "importReference"
« Reply #1 on: May 04, 2023, 12:14:44 PM »
Hello Mojtaba,

Can you provide a couple of lines from the csv file that you are importing to the project and also a screenshot of the image folder contents (switched to Details view - so that the filenames are fully visible)?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Mojtaba Goudarzi

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: The Command "importReference"
« Reply #2 on: May 04, 2023, 01:44:54 PM »
Below are two lines from the CVS file:

Time (HH:mm:ss.fff);count;format;name;Latitude (deg);Position accuracy north (m);Longitude (deg);Position accuracy east (m);Altitude (m);Position accuracy down (m);Speed horizontal (m/s);Speed horizontal accuracy (m/s);Speed 3D (m/s);Speed 3D accuracy (m/s);Velocity up (m/s);Velocity accuracy up (m/s);Heading (deg);Heading accuracy (deg);Roll (deg);Roll accuracy (deg);Pitch (deg);Pitch accuracy (deg)

13:35:52.080;84;.TIF;84.TIF;53.5314878456467;1.352;8.06851422597502;1.352;484.349487304688;0.964;39.5890933562515;0.23829603437741;39.7438237431931;0.241;3.5036;0.036;174.024643002423;0.348358339439541;2.9715883086665;0.157563393660976;12.9602480300797;0.13235325067522

13:35:54.080;85;.TIF;85.TIF;53.532341799271;1.231;8.06817580781549;1.231;492.943542480469;0.945;39.0536077863493;0.305473403097553;39.2534007480881;0.307827873981548;3.9554;0.038;172.882222454712;0.351223128415195;2.9050106128723;0.16673071838307;12.9901564269855;0.143239448782706

And also the CVS file and the detail view of the images folder are attached.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: The Command "importReference"
« Reply #3 on: May 04, 2023, 02:06:41 PM »
Hello Mojtaba,

Seems like you need to modify the order of the columns for the csv data import.

Try the following value for the columns argument:
Code: [Select]
"   nyYxXzZ      aAcCbB"
Best regards,
Alexey Pasumansky,
Agisoft LLC

Mojtaba Goudarzi

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: The Command "importReference"
« Reply #4 on: May 09, 2023, 11:10:08 AM »
Hallo Alexey,
I changed the names of the columns, but still after running the program, the reference was not imported.

Best Regards

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: The Command "importReference"
« Reply #5 on: May 11, 2023, 08:53:46 PM »
Hello Mojtaba,

Please provide the updated code that you are using and a screenshot of the Reference pane after running the script.

Best regards,
Alexey Pasumansky,
Agisoft LLC