Forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - talldrinks

Pages: [1]
1
Hello.
When I reconstruct, I also import a camera position CSV file as reference. This properly scales and orients the scene to the Agisoft grid axes reliably.

My issue is that I want programmatically scale and orient the build region after this step. My script below is run after alignment and importing the CSV file (which does correctly scale and orient the entire camera rig).
It appears that the region parameters are always in relation to one of the aligned cameras, and doesn't seem to be the same camera every time, so I'm having trouble reliably placing the build region box at the center of the rig on the ground plane where I need it. I can offset and rotate the box, but since its relative to some camera each build, it's not reliable.

How can I best place the region in my chunk at an absolute position in world space (for instance, at 0.0,0.0,2.0 and scaled to 3.5,3.5,4.0)?

Thank you!

My script: (apologies, the code tag button is not working in Edge browser)
<code>
#load CSV reference file
   try:
      #import csv reference for scale and orientation
      csvFilePath = (path+"/CameraData/CamData.csv")
      print("Loading references from "+csvFilePath)
      chunk.loadReference(csvFilePath,PhotoScan.ReferenceFormat.ReferenceFormatCSV,'nxyzXYZ',',')
      chunk.updateTransform()
      print("loaded references!")
   except:
      print("couldn't load references")
   
   #set volume bounding box
   print("===Setting Bounding Box Volume===")
   new_region = PhotoScan.Region()

   new_center = PhotoScan.Vector([0.0,0.0,2.0]) #this offsets relative to some cameras Z axis, undesired
   #new_center = offset + new_rot * new_center

   x_scale = 3.5
   y_scale = 3.5
   z_scale = 4.0

   new_size = PhotoScan.Vector([x_scale, y_scale, z_scale])

   T = PhotoScan.app.document.chunk.transform.matrix
   v_t = T * PhotoScan.Vector( [0,0,0,1] )
   m = PhotoScan.Matrix.Diag( (1,1,1,1) )

   m = m * T
   s = math.sqrt(m[0,0] ** 2 + m[0,1] ** 2 + m[0,2] ** 2) #scale factor

   R = PhotoScan.Matrix( [[m[0,0],m[0,1],m[0,2]], [m[1,0],m[1,1],m[1,2]], [m[2,0],m[2,1],m[2,2]]])
   R = R * (1.0 / s)

   new_region.size = new_size
   new_region.center = new_center
   new_region.rot = R.t()

   PhotoScan.app.document.chunk.region = new_region
   PhotoScan.app.update()
</code>

2
Python and Java API / One build script across multiple nodes
« on: April 05, 2017, 03:50:54 PM »
Hello!
I've got a script which does a complete build:
Match
Align
Dense
Mesh
Uv
*texture path swap
*disables all mono cameras before texturing
*texture projection
*loads reference CSV for orient and scale
*Export files
*save scene

My question is, what happens during the above starred* steps when the job is distributed across a farm of Agi nodes?

First off, do I just call the script from the control mode pc?
Does that script then get sent out to the other nodes for processing?
How does each node know which piece of the script it should run?

Do all results get returned to the main node for texture processing and file exports?

Thank you. I know it's many questions.


3
Morning (or evening),

I've got a basic script like this:

Code: [Select]
print("===Match Photos===")
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, preselection=PhotoScan.NoPreselection, filter_mask=True, keypoint_limit=30000, tiepoint_limit=30000)

print("===Align Cameras===")
chunk.alignCameras()

print("===Export Cameras===")
chunk.exportCameras(path+"/Scan Mesh/Cameras.xml")

print("===Build Dense Cloud===")
chunk.buildDenseCloud(quality=PhotoScan.HighQuality, filter=PhotoScan.AggressiveFiltering, keep_depth=True, reuse_depth=False)

print("===Build Model===")
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation, face_count=500000)

print("===Build UVs===")
chunk.buildUV(mapping=PhotoScan.GenericMapping)
...

This fails to build the dense cloud step, and throws the error: "problem".

output:
2017-03-22 12:01:09 ===Build Dense Cloud===
2017-03-22 12:01:09 BuildDenseCloud: quality = Low, depth filtering = Aggressive
2017-03-22 12:01:09 Initializing...
2017-03-22 12:01:09 Using device: GeForce GTX 1070, 15 compute units, 8192 MB global memory, CUDA 6.1
2017-03-22 12:01:09   max work group size 1024
2017-03-22 12:01:09   max work item sizes [1024, 1024, 64]
2017-03-22 12:01:09 Using CUDA device 'GeForce GTX 1070' in concurrent. (4 times)
2017-03-22 12:01:09 sorting point cloud... done in 0.001 sec
2017-03-22 12:01:09 processing matches... done in 0.001 sec
2017-03-22 12:01:09 initializing...
2017-03-22 12:01:09 selected 0 cameras from 20 in 0.003 sec
2017-03-22 12:01:09 Loading photos...
2017-03-22 12:01:09 loaded photos in 0.001 seconds
2017-03-22 12:01:09 Reconstructing depth...
2017-03-22 12:01:09 finished depth reconstruction in 0.001 seconds
2017-03-22 12:01:09 Device 1: 0% work done with performance: 0 million samples/sec (CPU), device used for 0 seconds
2017-03-22 12:01:09 Device 2: 0% work done with performance: 0 million samples/sec (GeForce GTX 1070), device used for 0 seconds
2017-03-22 12:01:09 Generating dense point cloud...
2017-03-22 12:01:09 selected 0 cameras in 0.002 sec
2017-03-22 12:01:09 Finished processing in 0.029 sec (exit code 0)
2017-03-22 12:01:09 problem


If I manually build high quality point cloud in the GUI, it works fine.

Is this a strange memory issue somehow?

thanks.

4
Python and Java API / loadReference returning odd error
« on: March 12, 2017, 10:01:34 AM »
Hi friends.
I just keep getting this error when I try to loadReference, using a csv file, which works fine if loaded manually in the GUI...

My python script:
csvFilePath = "C:/temp/CamData.csv"
chunk.loadReference(path='csvFilePath', format='csv', columns='nxzyXZY', delimiter=',')

Error in Agi:

Traceback (most recent call last):  File "C:/temp/tempScript.py", line 2, in <module>
PhotoScan.app.document.chunk.loadReference('csvFilePath','csv','nxzyXZY',',')
TypeError: argument 2 must be TiffCompressionDeflate, not str

TiffCompressionDeflate!? I don't get it. On Version 1.3.0, Build 3772, 64-bit

Thank you! (sorry about formatting, the web markup tools aren't doing anything for me, I tried to wrap lines as #code)

Pages: [1]