Hello. I'm trying to make a 3D DEM matrix in the Agisoft console using this code:
import PhotoScan
chunk = PhotoScan.app.document.chunk #active chunk
camera = chunk.cameras[11]
calibration = camera.sensor.calibration
import numpy as np
import scipy.io as io
xyz0 = np.zeros((1632,1200,3))
for i in range(1632):
for j in range(1200):
point2D = PhotoScan.Vector([i, j]) # coordinates of the point on photo
point3Di = chunk.dense_cloud.pickPoint(camera.center, camera.transform.mulp(calibration.unproject(point2D)))
if point3Di is not None:
point3Dg = chunk.crs.project(chunk.transform.matrix.mulp(point3Di))
xyz0[i,j,0] = point3Dg[0]
xyz0[i,j,1] = point3Dg[1]
xyz0[i,j,2] = point3Dg[2]
out={}
out['xyz']=xyz0
io.savemat('xyz_out2',out)
For some reason, if I run this in a saved session, it runs very slowly and Agisoft only uses 0/1 CPUs. However, if I run this in a new/unsaved session after regenerating a Dense Cloud, it runs quickly while using 3 CPUs. Could anyone explain why Agisoft chose to use different numbers of CPU here?
Thank you.
(My system has 32 CPUs with 65 GB memory)