Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: ilia on May 26, 2022, 11:07:51 AM

Title: Selecting cameras and meshes by shapes from script
Post by: ilia on May 26, 2022, 11:07:51 AM
Hi!

I'm trying to establish texturing of big models with a decent texture quality and solution I found it to divide already meshed model into smaller meshes, texture them separately with a maximum atlas which fits into GPU and merge them after.

Worked out well so far. But there are single issue which bothers me a lot.

It seems that the only way to select part of the mesh from the script is to use Shape. There are no other ways to subdivide a mesh, is it correct? For an example, I can subdivide sparse point cloud by putting smaller regions which do have 3D form as it done in split_in_chunks_dialog.py. Here we have full control (up to Rectangular cuboid) in 3D. But with Shapes I'm able to select only x and y and project them into some "common plane". I believe the plane is which this model is referenced to and if I set reference frame as local it is a grid I see in the viewer.

Problems arrive when I use georeferenced models. Sometimes model got tilted to this grid. And using division mesh by Shapes it's got projected on this inclined referenced geoframe. To solve it I need to go to local reference, align the model with axes of grid and do this division.

My questions are:
1. Is there a way to select parts of mesh and divide it not by Shapes? I can split sparse point cloud in chunks by using .region, but splitting the mesh requires Shapes.
2. I don't think I understand shapes fully. I see that I'm able to draw them in 3D, but all shapes at the end should be projected into some plane: image plane or reference plane. Are there ways to do some sort of "3D Shapes" without being forced to project one of three coordinates? I read both Python API and Pro documentations and still I don't have a full picture of this selection capabilities and Shapes especially.
3. I also would like to select and switch on-off cameras based on their proximity to subparts of the mesh. For this I would like to use some spherical selection. But it seems that so far I can use only cylindrical selection based on Shapes.
4. Is it possibly somehow to use the same selection tool as in GUI from Python? Select the center of the point, draw circle, project it based on the current view and select cameras/polygons to operate on.