Forum

Author Topic: loadReference again  (Read 5086 times)

hanparker

  • Newbie
  • *
  • Posts: 25
    • View Profile
loadReference again
« on: September 21, 2015, 04:20:53 PM »
At the moment I am loading the reference data manually. I'm setting a chunk active, clicking the reference pane and selecting "import".

The reference file is held in a .txt file in csv format.

I tried a script that looks like it should work. The return value of "loadReference" is true - but the X,Y,Z values of the photos never updates if I checked the reference pane.

The script is simply:

print("Script started")

for i in range(len(doc.chunks)-1):      
   chunk = doc.chunks
   checkloaded = chunk.loadReference("path.txt",'csv')
      
   PhotoScan.app.update()
   print(i, checkloaded)


print("Photos imported")

Anyone see where I am going wrong?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: loadReference again
« Reply #1 on: September 21, 2015, 04:22:43 PM »
Hello hanparker,

you should use
Code: [Select]
chunk = doc.chunk line for the active chunk.
Best regards,
Alexey Pasumansky,
Agisoft LLC

hanparker

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: loadReference again
« Reply #2 on: September 21, 2015, 04:30:44 PM »
Hi Alexey,

My square brackets were removed by formatting here I think. So if I just try to apply to a single chunk by doing this:



chunk = doc.chunks[-1]
checkloaded = chunk.loadReference("path.txt",'csv')   
PhotoScan.app.update()


or

chunk = doc.chunk
checkloaded = chunk.loadReference("path.txt",'csv')

   



It still doesn't do anything - it returns true but nothing is updated when I manually check?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: loadReference again
« Reply #3 on: September 21, 2015, 05:00:39 PM »
Hello hanparker,

I can suggest to use absolute path to the text file at first, also the file format that you are using may be different from the one supported in 1.1.6 via Python. Can you please attach the text file that you are using (or just a few sample lines)?
Best regards,
Alexey Pasumansky,
Agisoft LLC

hanparker

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: loadReference again
« Reply #4 on: September 21, 2015, 05:07:31 PM »
HI Alexey,

Thanks - I am using absolute path in the format as follows (I've checked and confirmed the file is definately there!)

checkloaded = chunk.loadReference("Z:\\Circuits\\sampleRef.txt",'csv')

I've attached a sample. If I manually import this file as described in my first post, it works fine - so I know that the file labels in the file match the names .

Thanks for your help.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: loadReference again
« Reply #5 on: September 21, 2015, 05:11:17 PM »
Hello hanparker,

I think that loadReference() function in 1.1.6 assumes that there's tab delimiter. In the next version it would be possible to use custom option via Python.
Best regards,
Alexey Pasumansky,
Agisoft LLC

hanparker

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: loadReference again
« Reply #6 on: September 21, 2015, 05:16:33 PM »
Aha! Great. Thanks very much!