Agisoft Metashape

Agisoft Metashape => General => Topic started by: mwillis on January 08, 2019, 06:30:47 AM

Title: Importing images from list in a text file
Post by: mwillis on January 08, 2019, 06:30:47 AM
Hi, I am hoping someone can point me in the right direction.  I have a text file with a large number of photos that I would like to add to a new project.  The images are scattered across several partitions and for reasons that are complicated, I need to leave the images in their current directors.

Is there a way to automatically add files from a text file with the following syntax?

I:\Projects\Marsoulas\D31-D42.5\Wall_Base_Gilles\D37-39_Mos releve 2018Willis.jpg
I:\Projects\Marsoulas\D31-D42.5\Wall_Base_Gilles\D37_38_Connector releve 2018Willis.jpg
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8246.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8003.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8004.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8005.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8006.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8007.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8008.JPG
G:\Projects\Marsoulas\2014\Photos\Right\D33-39\9M7A8009.JPG
... files continue for hundreds of lines

Thanks for any help you can share.

Mark
Title: Re: Importing images from list in a text file
Post by: Alexey Pasumansky on January 08, 2019, 09:08:42 PM
Hello Mark,

You can do it with the Python script:

Code: [Select]
import PhotoScan
path = PhotoScan.app.getOpenFileName("Specify the location of the text file with the paths:")
file = open(path, "rt")
lines = file.readlines()
lines = [line.strip() for line in lines]
chunk = PhotoScan.app.document.addChunk()
chunk.addPhotos(lines)
file.close()
Title: Re: Importing images from list in a text file
Post by: mwillis on January 20, 2019, 04:24:46 PM
Thank you, sir!