Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: smihic on February 20, 2015, 12:15:25 PM

Title: Finding the minimal bounding box
Post by: smihic on February 20, 2015, 12:15:25 PM
Hi,
  I want to set the minimal bounding box around the center of the chunk. I find the center from the camera positions, and then create maximal bounding box (according to camera positions) and create low poly mesh. After that I find the minimum/maximum values for x,y,z (from mesh vertices) and use them to create minimal bounding box. The issue I am having is that center of this bounding box is not set right (its is moved and results that some parts are not inside of the box):

Code: [Select]
newregion.center = PhotoScan.Vector( [ xmin + (abs(xmax - xmin))/2.0, ymin + (abs(ymax - ymin))/2.0, zmin + (abs(zmax - zmin))/2.0 ] )

newregion.size = PhotoScan.Vector( [ abs(xmax - xmin),  abs(ymax - ymin), abs(zmax - zmin) ] ) / s

I don't change rotation of region, but still I get that some parts of the model are outside of this minimal bounding box. Can you help?