Agisoft Metashape
Agisoft Metashape => General => Topic started by: chehroma on January 16, 2018, 12:27:39 PM
-
In 1.3.4 i use script for change photo
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:
Error: Can't open file: No such file or directory (2): d:/FTP/1516031537175/firstdir/1
Can you help me?
-
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.
-
Thank, but I have the same problem. This is my advanced preferences dialog. What are items I need to off/on.
-
Hello chehroma:
Preferences -> Advanced -> Export / Import -> Strip file extensions from camera labels.
-
Dont work, the same error.
Error: Can't open file: No such file or directory (2): d:/FTP/1516031537175/first/1
-
This is my preference.
-
Hello chehroma,
Can you please post the screenshot of the camera list from the Workspace pane?
-
Please)
-
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.
-
I turn off "strip file extensions", restart agisoft, add photo by script (it added). Than try change to another and have the same problem.
-
Help me add + ".jpg", but i dont understund why it?
for i in range(len(chunk.cameras)):
camera = chunk.cameras[i]
photo = camera.photo.copy()
photo.path = firstdir + camera.label + ".jpg"
camera.photo = photo
-
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:
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).