Forum

Author Topic: Change photo  (Read 1099 times)

chehroma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Change photo
« on: January 16, 2018, 12:27:39 PM »
In 1.3.4 i use script for change photo
Code: [Select]
for i in range(len(chunk.cameras)):
camera = chunk.cameras[i]
photo = camera.photo.copy()
photo.path = firstdir + camera.label
camera.photo = photo
Now in 1.4 I have an error:
Quote
Error: Can't open file: No such file or directory (2): d:/FTP/1516031537175/firstdir/1

Can you help me?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10626
    • View Profile
Re: Change photo
« Reply #1 on: January 16, 2018, 12:34:47 PM »
Hello chehroma,

In the version 1.4.0 there's an option in the Advanced preferences dialog that allows to exclude the filename extension from the camera labels when the photos are added to the project. If the option is turned on in your case, you can uncheck it, re-load the photos to the new chunk and try the script again.
Best regards,
Alexey Pasumansky,
AgiSoft LLC

chehroma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Change photo
« Reply #2 on: January 16, 2018, 12:46:35 PM »
Thank, but I have the same problem. This is my advanced preferences dialog. What are items I need to off/on.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10626
    • View Profile
Re: Change photo
« Reply #3 on: January 16, 2018, 12:48:53 PM »
Hello chehroma:

Preferences -> Advanced -> Export / Import -> Strip file extensions from camera labels.
Best regards,
Alexey Pasumansky,
AgiSoft LLC

chehroma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Change photo
« Reply #4 on: January 16, 2018, 12:54:42 PM »
Dont work, the same error.
Quote
Error: Can't open file: No such file or directory (2): d:/FTP/1516031537175/first/1

chehroma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Change photo
« Reply #5 on: January 16, 2018, 12:55:52 PM »
This is my preference.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10626
    • View Profile
Re: Change photo
« Reply #6 on: January 16, 2018, 01:05:12 PM »
Hello chehroma,

Can you please post the screenshot of the camera list from the Workspace pane?
Best regards,
Alexey Pasumansky,
AgiSoft LLC

chehroma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Change photo
« Reply #7 on: January 16, 2018, 01:48:12 PM »
Please)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10626
    • View Profile
Re: Change photo
« Reply #8 on: January 16, 2018, 01:58:52 PM »
Hello chehroma,

So the images were added to the project before "strip file extensions" option was disabled?

The option has effect only on the photos added to the project after it's status has been modified. It wouldn't make any changes to already created and existing projects.
Best regards,
Alexey Pasumansky,
AgiSoft LLC

chehroma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Change photo
« Reply #9 on: January 16, 2018, 02:26:39 PM »
I turn off "strip file extensions", restart agisoft, add photo by script (it added). Than try change to another and have the same problem.
« Last Edit: January 16, 2018, 02:28:47 PM by chehroma »

chehroma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Change photo
« Reply #10 on: January 16, 2018, 03:17:33 PM »
Help me add + ".jpg", but i dont understund why it?

Code: [Select]
for i in range(len(chunk.cameras)):
camera = chunk.cameras[i]
photo = camera.photo.copy()
photo.path = firstdir + camera.label + ".jpg"
camera.photo = photo

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10626
    • View Profile
Re: Change photo
« Reply #11 on: January 16, 2018, 07:47:20 PM »
Hello chehroma,

It seems that Preference setting in 1.4.0 doesn't have any effect on Python .addPhotos() operation and the extension is always stripped. So you can add it back to the labels using the following code:
Code: [Select]
for camera in chunk.cameras:
   camera.label += "." + camera.photo.path.rsplit(".", 1)[1]
Thus you'll be able to import XML with the cameras from the older versions (where the camera labels contain the image extension).
Best regards,
Alexey Pasumansky,
AgiSoft LLC