Forum

Author Topic: How to set region volume to 2 camera locations?  (Read 6054 times)

Fernando

• Newbie
• Posts: 16
How to set region volume to 2 camera locations?
« on: July 07, 2014, 01:39:21 AM »
Hi, I was wondering if I could manually set the region bounding box to 2 points in space: 2 camera locations.

So for example these are the camera locations:

cam1(0,0,0)
cam2(100,100,100)

Together they form the maximum / most outer points of the region volume.

How can I set the region to that volume?

Thanks!
« Last Edit: July 08, 2014, 10:29:31 AM by Fernando »

Fernando

• Newbie
• Posts: 16
Re: How to set region volume to 2 camera locations?
« Reply #1 on: July 09, 2014, 02:19:17 PM »
Hi, maybe someone could help me? Or is this a really dumb question? Sorry, I'm a total Python noob

Alexey Pasumansky

• Agisoft Technical Support
• Hero Member
• Posts: 14971
Re: How to set region volume to 2 camera locations?
« Reply #2 on: July 09, 2014, 03:03:44 PM »
Hello Fernando,

Are region sides supposed to be parallel to the coordinate system planes?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Fernando

• Newbie
• Posts: 16
Re: How to set region volume to 2 camera locations?
« Reply #3 on: July 09, 2014, 05:05:05 PM »
Hello Alexey,

No, that is not necessary.

Thanks

Alexey Pasumansky

• Agisoft Technical Support
• Hero Member
• Posts: 14971
Re: How to set region volume to 2 camera locations?
« Reply #4 on: July 09, 2014, 05:15:50 PM »
Hello Fernando,

Code: [Select]
`import PhotoScandoc = PhotoScan.app.documentchunk = doc.activeChunkp1 = PhotoScan.app.getInt("Specify first camera index:", 0)p2 = PhotoScan.app.getInt("Specify second camera index:", len(chunk.cameras)-1)p1 = chunk.cameras[p1]p2 = chunk.cameras[p2]region = PhotoScan.Region()dist = p2.center - p1.centerregion.size = PhotoScan.Vector([dist.x, dist.y, dist.z])region.center = (p1.center + p2.center) / 2.region.rot = PhotoScan.Matrix().diag([1,1,1])chunk.region = regionPhotoScan.app.update()`