Forum

Author Topic: Automatic create leveled bounding box  (Read 4828 times)

3dmij

  • Newbie
  • *
  • Posts: 30
  • I make raspberry pi 3d Scanners
    • View Profile
    • pi3dscan
Automatic create leveled bounding box
« on: February 02, 2016, 05:16:13 PM »
Hi Everyone,

Well I think is "just" took me about 2 years to nail this script, so I thought it was time to share with you all.

I have created an script that based on floor markers and side markers, fully automatically created a correct bounding box, so you can easily cut out floor and have correct orientation for games engines like unity / mixamo.

Here the instructions and download to the script and floormat design:
http://www.pi3dscan.com/index.php/instructions/item/agisoft-how-to-process-a-scan-with-projection

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13913
    • View Profile
Re: Automatic create leveled bounding box
« Reply #1 on: February 02, 2016, 06:57:01 PM »
Thanks for sharing! Just today have watched it on Youtube.
Best regards,
Alexey Pasumansky,
Agisoft LLC

reperry

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Automatic create leveled bounding box
« Reply #2 on: February 18, 2016, 12:42:16 AM »
Thanks for sharing the script! It was hugely helpful in getting me started scripting for Agisoft. I am now modifying it for my own use, but I am confused. I would like to set a different center for the bounding box.

Currently (3dmij's script):
Code: [Select]
mx = (chunk.markers[c1].position + chunk.markers[c2].position + chunk.markers[c3].position + chunk.markers[c4].position) / 4.
mx = PhotoScan.Vector([mx[0], mx[1], mx[2]])
newregion.center = mx

This also works:
Code: [Select]
m2 = chunk.markers[mp0].position
m2 = PhotoScan.Vector([m2[0], m2[1], m2[2]])
newregion.center = m2

But when I try to shift the bounding box along one of the axes by adding a constant to one of the values, I see the box move along a diagonal path in my coordinate system:
Code: [Select]
m2 = chunk.markers[mp0].position
m2 = PhotoScan.Vector([m2[0], m2[1], m2[2]+5])
newregion.center = m2

Are there multiple coordinate systems at work here? It would be really nice if  could shift the bounding box in the coordinate system that is the same as the RGB arrows that show on the screen.

3dmij

  • Newbie
  • *
  • Posts: 30
  • I make raspberry pi 3d Scanners
    • View Profile
    • pi3dscan
Re: Automatic create leveled bounding box
« Reply #3 on: March 01, 2016, 10:58:27 PM »
Now you know why I use markers to calculate the center :-(

there are multiple coordinate systems at work, very confusing, that is why it took me ages to come up with this solution.