Forum

Author Topic: importRerference questions  (Read 8534 times)

3DWinter

  • Full Member
  • ***
  • Posts: 103
    • View Profile
importRerference questions
« on: November 24, 2020, 10:53:25 AM »
Hello,
despite there are many references on how to use importReference in both the forum history and a few in the manual, I could not find answers to my questions.

First regarding the columns parameters,  in the manual, the reference is for 'n/x/y/z', but in most of the posts in the forum people wrote nxyz, does it matter!? What happens if I have a few six columns and not four. Say I don't want to assign the two last columns. How do I choose what columns to assign and whatnot (like in the GUI)?
I did try columns='nxyzXYZ' (including location accuracies) and that did not work.  Currently, if I keep my reference file to four columns only and import with columns='nxyz' it works, but that is not ideal for me!
FYI even in the official response https://www.agisoft.com/forum/index.php?topic=10265.msg46849#msg46849 there are no '/'

The second question is what is the purpose of the format=Metashape.ReferenceFormatCSV? I have already defined delimited=',' and seems to work fine without the former, comments?
thanks
« Last Edit: November 24, 2020, 08:45:45 PM by 3DWinter »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: importRerference questions
« Reply #1 on: November 24, 2020, 12:15:38 PM »
Hello 3DWinter,

Can you please provide a few lines from the CSV file that you are trying to import?

Note that you should always have the column with the camera or marker label.
Best regards,
Alexey Pasumansky,
Agisoft LLC

3DWinter

  • Full Member
  • ***
  • Posts: 103
    • View Profile
Re: importRerference questions
« Reply #2 on: November 24, 2020, 10:01:20 PM »
Hey Alexey,
So I did four different importing tests:
1. Imported a "skinny" file with only the necessary columns four columns, for importReference I used columns='nxyz' -which worked fine
2. Imported  the original files that have other columns (at the end), for importReference I used columns='nxyz' -which didn't work
3.Imported a file that in addition to the "skinny" file has three additional accuracy columns of the SDHorizonX, SHorizonY, SDHeight, for importReference I used columns='nxyzXYZ' -which I don't think worked- the accuracy column has two numbers in bold with"/" in between.

Attached are the respected printscreens to the above tests.


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: importRerference questions
« Reply #3 on: November 26, 2020, 09:16:58 PM »
Hello 3DWinter,

I have managed to import the xyz coordinates and planar&height measurement accuracy from the "csv_test_with nxyz-seven_columns-failed.JPG" example using the following command:
Code: [Select]
chunk.importReference(path, delimiter=",", columns="nxyz[XY]Z")Here x-accuracy and y-accuracy are read from the same column and the representation with "slash" in the GUI Accuracy column means that the XY accuracy is the first value and Z accuracy - second: XY/Z. If you load different values for all the coordinate accuracies, you will see X/Y/Z in GUI.

Actually, for the same input columns="nxyz" allows to load only XYZ coordinates.



 format=Metashape.ReferenceFormatCSV is the default option, so you can omit using format argument, if you are using plain-text CSV input. However, there are also some other reference import formats supported, which require proper format option definition.
Best regards,
Alexey Pasumansky,
Agisoft LLC

3DWinter

  • Full Member
  • ***
  • Posts: 103
    • View Profile
Re: importRerference questions
« Reply #4 on: November 28, 2020, 02:04:31 AM »
Hello Alexey,
 I tried
Code: [Select]
chunk.importReference(path=img_ref,format=Metashape.ReferenceFormatCSV,delimiter=',',skip_rows=1,columns='nxyz[XY]Z',crs=crsi)
But this only took in the XY not height , you can see in the attachment below SDY_orSDX_noSDHeight.JPG

Then I tried  tried
Code: [Select]
chunk.importReference(path=img_ref,format=Metashape.ReferenceFormatCSV,delimiter=',',skip_rows=1,columns='nxyzXYZ',crs=crsi)And got (attachment nxyzXYZ.JPG) accuracy(m) 0.733/1.294, and as I understand from your description above makes sense!? I am just surprised that according to your statement above  Metashape compared the numbers of SDHorizX and SDHorizY Aand because the columns are the same made it one column- that seems over intelligent software. 

I didn't understand your statement:   "Actually, for the same input columns="nxyz" allows to load only XYZ coordinates."

Also, what is the difference between the Accuracy (m) column and Camera Accuracy(m) in Reference Setting Measurement Accuracy in the GUI?

Again thanks for all of your time explaining this to me.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: importRerference questions
« Reply #5 on: November 28, 2020, 04:49:41 PM »
Hello 3DWinter,

I have used example from csv_test_with nxyz-seven_columns-failed.JPG  screenshot, where X and Y accuracy seem to be represented in the single column.

So I've got the following input now, with additional column added:
Code: [Select]
DSC00578.JPG, 52019.370, 1573564.404, 1408.761, 0.733,0.733, 1.294,429274.05
DSC00579.JPG, 52021.373, 1573565.444, 1438.762, 0.233,0.733, 0.294,429279.05
DSC00580.JPG, 52219.837, 1573563.484, 1418.763, 0.763,0.733, 1.294,429284.05
DSC00581.JPG, 52118.371, 1573561.424, 1428.764, 0.733,0.733, 1.894,429289.15
To import x, y, z coordinates and the measurement accuracy for each coordinate from individual column, I have used the following line:
Code: [Select]
chunk.importReference(path, delimiter=",", columns="nxyzXYZ")Everything is exported properly.

As for the values in the "Accuracy (m)" column. When you see single value in the cell - it is means that the same value is related to X, Y and Z coordinate. When two values are displayed - the first is related to X and Y accuracy, while the second - to Z accuracy. Three values represent individual accuracy for X, Y, Z coordinates respectively.  For manual input via GUI "slash" delimiter should be used in Modify... -> Accuracy (m) box, if separate accuracy values should be input for X, Y and Z.

Camera accuracy and Marker accuracy values in the Reference pane settings dialog represent the default accuracy values (here individual accuracy can be also applied) that is shown in the Reference pane unless you import the accuracy from file or input manually.
Best regards,
Alexey Pasumansky,
Agisoft LLC

marcel.d

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: importRerference questions
« Reply #6 on: August 31, 2023, 04:43:19 PM »
Hi,

is there a character we can use to tell Metashape to skip certain columns from an imported csv?
e.g. consider a file with these columns:

Code: [Select]
label,x,y,z,skip_col,x_accuracy,y_accuracy,z_accuracy
Will the following code work?

Code: [Select]
chunk.importReference(path, delimiter=",", columns="nxyzsXYZ")
Notice the "s" in the "nxyzsXYZ" (because I assume s=skip).
Of course we can rearrange the columns before importing, but a skip-column character seems more elegant and these kinds of files can be easily imported in the GUI. - so why not CLI?

Thanks,
Marcel

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: importRerference questions
« Reply #7 on: August 31, 2023, 05:57:15 PM »
Hello Marcel,

Can you try to use "space" symbol for skip columns? Like columns="nxyz XYZ". Let me know, if it works as expected.
Best regards,
Alexey Pasumansky,
Agisoft LLC

marcel.d

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: importRerference questions
« Reply #8 on: November 29, 2023, 02:03:52 PM »
Dear Alexey,

thank you for your suggestion and sorry for the late reply. We decided against the use of spaces within the string and instead rearranged the columns, so the "useless" columns come at the end and the string "nxyzXYZ" works great.

Also, while playing with file formats for the images, we ran into the issue where importReference does not work if the file ending is lacking in the CSV file (like in this post: https://www.agisoft.com/forum/index.php?topic=11165.0).

Kind regards,
Marcel
« Last Edit: November 29, 2023, 02:07:12 PM by marcel.d »