Forum

Author Topic: align bounding box to GCP coordinates x,y,z planes  (Read 8595 times)

bisenberger

• Sr. Member
• Posts: 329
align bounding box to GCP coordinates x,y,z planes
« on: July 12, 2014, 12:46:07 PM »
It would be nice if the bounding box would align to the x,y,z plane defined by GCP's.
Digital Mapping & Graphics LLC
https://digital-mapping.net/

Alexey Pasumansky

• Agisoft Technical Support
• Hero Member
• Posts: 15029
Re: align bounding box to GCP coordinates x,y,z planes
« Reply #1 on: July 29, 2014, 08:33:44 AM »
Hello bisenberger,

We are considering such option built-in GUI, but at the moment custom script can be use to align bounding box according to the coordinate system. The sample script is in Python Scripting sub-forum.
Best regards,
Alexey Pasumansky,
Agisoft LLC

bisenberger

• Sr. Member
• Posts: 329
Re: align bounding box to GCP coordinates x,y,z planes
« Reply #2 on: August 10, 2014, 09:44:59 PM »
Thanks Alexey
Digital Mapping & Graphics LLC
https://digital-mapping.net/

Alexey Pasumansky

• Agisoft Technical Support
• Hero Member
• Posts: 15029
Re: align bounding box to GCP coordinates x,y,z planes
« Reply #3 on: August 15, 2014, 11:03:25 AM »

Code: [Select]
`import PhotoScan import mathdoc = PhotoScan.app.documentchunk = doc.activeChunkT = chunk.transformv = PhotoScan.Vector( [0,0,0,1] )v_t = T * vv_t.size = 3if chunk.crs: m = chunk.crs.localframe(v_t)else: m = PhotoScan.Matrix().diag([1,1,1,1])m = m * Ts = math.sqrt(m[0,0]*m[0,0] + m[0,1]*m[0,1] + m[0,2]*m[0,2]) #scale factorR = 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. / s)reg = chunk.regionreg.rot = R.t()chunk.region = reg`
Best regards,
Alexey Pasumansky,
Agisoft LLC

bisenberger

• Sr. Member
• Posts: 329
Re: align bounding box to GCP coordinates x,y,z planes
« Reply #4 on: August 22, 2014, 04:36:07 PM »
Excellent!

Would it be possible to run the script from Batch Process?
Digital Mapping & Graphics LLC
https://digital-mapping.net/

bisenberger

• Sr. Member
• Posts: 329
align bounding box to GCP coordinates x,y,z planes broken in current release
« Reply #5 on: January 14, 2015, 08:49:52 PM »
The script that was posted in this thread no longer works in the current release, 1.1.0:

http://www.agisoft.com/forum/index.php?topic=2607.0
Digital Mapping & Graphics LLC
https://digital-mapping.net/

Alexey Pasumansky

• Agisoft Technical Support
• Hero Member
• Posts: 15029
Re: align bounding box to GCP coordinates x,y,z planes
« Reply #6 on: January 14, 2015, 08:58:10 PM »
Hello Bill,

There were some changes in Python API. Here's script modified for version 1.1:

Code: [Select]
`import PhotoScan import mathdoc = PhotoScan.app.documentchunk = doc.chunkT = chunk.transform.matrixif chunk.crs: v_t = T * PhotoScan.Vector( [0,0,0,1] ) v_t.size = 3 m = chunk.crs.localframe(v_t)else: m = PhotoScan.Matrix().diag([1,1,1,1])m = m * Ts = math.sqrt(m[0,0]**2 + m[0,1]**2 + m[0,2]**2) #scale factorR = 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. / s)reg = chunk.regionreg.rot = R.t()chunk.region = reg`
Best regards,
Alexey Pasumansky,
Agisoft LLC