Forum

Author Topic: Repoint missing image to another directory.  (Read 2001 times)

aaronfhd

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Repoint missing image to another directory.
« on: April 10, 2019, 05:05:25 PM »
Sometime we move images based on classification for our project.

But this causes missing images in our Agisoft Project.  Is there a script where we can find these missing images and repoint them to the new directory.

Thanks.

aaronfhd

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Repoint missing image to another directory.
« Reply #1 on: April 12, 2019, 02:26:45 PM »
Anyone?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14935
    • View Profile
Re: Repoint missing image to another directory.
« Reply #2 on: April 12, 2019, 03:43:31 PM »
Hello aaronfhd,

Please check the solutions mentioned here:
https://www.agisoft.com/forum/index.php?topic=9214.msg43161#msg43161

In the version 1.5.2 you need also to skip the cameras, which type is anything other from Metashape.Camera.Type.Regular
Best regards,
Alexey Pasumansky,
Agisoft LLC

aaronfhd

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Repoint missing image to another directory.
« Reply #3 on: April 12, 2019, 06:37:47 PM »
Just for other people reference  This will check to see if it exist and if it comes back false then you can repoint it to a new directory.

Code: [Select]
for i in range(len(chunk.cameras)):
    exist = os.path.isfile(chunk.cameras[i].photo.path)
    if exist == False:   
        #print('copyIm: '+chunk.cameras[i].photo.path)
        print(exist)
        imPath = delpath + os.path.basename(chunk.cameras[i].photo.path)
        #print(os.path.basename(chunk.cameras[i].photo.path))
        chunk.cameras[i].photo.path = imPath
        print (imPath)
« Last Edit: April 12, 2019, 06:43:26 PM by Alexey Pasumansky »