1
Python and Java API / add photo and save project
« on: August 25, 2015, 10:36:29 PM »
Hello
I'm using photoscan 1.1.6 and I wrote one little script which open and add all .tif photo from one directory and save this project to .psz but unfortunately the script is not work because can't open and add photos for chunk and I don't know why.
The error code:
if proejct_path[-4:].lower() != ".psz":
NameError: name 'proejct_path' is not defined
The script:
I would appreciate any help doing this. Thanks and sorry my poor English.
Regards
Peter
I'm using photoscan 1.1.6 and I wrote one little script which open and add all .tif photo from one directory and save this project to .psz but unfortunately the script is not work because can't open and add photos for chunk and I don't know why.
The error code:
if proejct_path[-4:].lower() != ".psz":
NameError: name 'proejct_path' is not defined
The script:
Code: [Select]
import os
import PhotoScan
global doc
doc = PhotoScan.app.document
#path to photos
path_photos = PhotoScan.app.getExistingDirectory("Specify input photo folder:")
print("Script started")
#creating new chunk
doc.addChunk()
chunk = doc.chunks[-1]
chunk.label = "New Chunk"
project_path = PhotoScan.app.getSaveFileName("Specify project filename for saving:")
if not project_path:
print("Script aborted")
if proejct_path[-4:].lower() != ".psz":
project_path += ".psz"
#loading images
image_list = os.listdir(path_photos)
photo_list = list()
for photo in image_list:
if ("TIFF" or "tif") in photo.lower():
photo_list.append(path_photos + "\\" + photo)
chunk.addPhotos(photo_list)
doc.save()
PhotoScan.app.update()
print("Script finished")
I would appreciate any help doing this. Thanks and sorry my poor English.
Regards
Peter