When I run photoscan.sh -platform offscreen -r script.py I most of the time get segmentation fault
photoscan.sh: line 19: 27666 Segmentation fault (core dumped) "$dirname/$appname" "$@"
It appears when I do chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=True,reference_preselection=False) after addPhotos.
AddPhotos
MatchPhotos: accuracy = High, preselection = generic, keypoint limit = 40000, tiepoint limit = 4000, constrain features by mask = 0
photoscan.sh: line 19: 21670 Segmentation fault (core dumped) "$dirname/$appname" "$@"
Now and then it works without segmentation fault but it is rare
I've tried version 1.3.4, 1.3.3 and 1.3.2 but the result are the same
I'm certain that the list of photos for addPhotos is valid as I create it from os.list.dir and have confirmed the paths.
Even though I don't think it is the root problem is there a way for photoscan to check or return the number of added photos or their paths?
I'm running this on a server without CPU
model name : Intel(R) Xeon(R) CPU E5-26xx v4
cpu MHz : 2394.446
cache size : 4096 KB
Linux VM_154_79_centos 2.6.32-642.6.2.el6.x86_64
Segmentation fault in bold below
--- script.py start ---
import PhotoScan
import os
import json
import datetime
def timestampAndAppendTextToFile(text, file):
stamp = datetime.datetime.now()
stamp = str(stamp) + " " + text + os.linesep
f=open(file, 'a+')
f.write(stamp)
f.close()
photoFolder = "imgs"
doc = PhotoScan.app.document
scriptdir = os.path.dirname(os.path.abspath(__file__))
logFile = os.path.join(scriptdir, "job.log")
doc.save(os.path.join(scriptdir, "psproject.psz"))
chunk = PhotoScan.app.document.addChunk()
# Get images in the folder
imgFolder = os.path.join(scriptdir, photoFolder)
print(scriptdir)
print(imgFolder)
includedExts = ['jpg', 'jpeg', 'png', 'tif']
file_names = []
for fn in os.listdir(imgFolder):
fnlower = fn.lower()
if any(fnlower.endswith(ext) for ext in includedExts):
file_names.append(os.path.join(imgFolder,fn))
timestampAndAppendTextToFile("Number of photos:" + str(len(file_names)), logFile)
timestampAndAppendTextToFile("Photos - start", logFile)
for fn in file_names:
timestampAndAppendTextToFile(fn, logFile)
timestampAndAppendTextToFile("Photos - end", logFile)
# Add processing server
GPUdevices = PhotoScan.app.enumGPUDevices()
prettyJson = json.dumps(GPUdevices, indent=2)
timestampAndAppendTextToFile(str(prettyJson), logFile)
try:
chunk.addPhotos(file_names)
timestampAndAppendTextToFile("Success Add photos done", logFile)
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=True,reference_preselection=False)
timestampAndAppendTextToFile("Success Match photos done", logFile)
except Exception as e:
timestampAndAppendTextToFile("PS_ERROR:" + str(e), logFile)
--- script.py end ---