I was using Metashape v1.8.2 and now i upgraded to v.2.0.3
I had a script to delete all points (tie points) that are Outside of the bounding box.
In the new version this script runs without giving me any error but it actually does nothing at all and it does not delete any points.
I do not know about scripting and i would like someone to help me convert this script to run properly in v.2.0.3
import Metashape
def main():
doc = Metashape.app.document
for i in range(len(doc.chunks)):
chunk = doc.chunks[i]
R = chunk.region.rot #Bounding box rotation matrix
C = chunk.region.center #Bounding box center vertor
size = chunk.region.size
if not (chunk.point_cloud and chunk.enabled):
continue
elif not len(chunk.point_cloud.points):
continue
for point in chunk.point_cloud.points:
if point.valid:
v = point.coord
v.size = 3
v_c = v - C
v_r = R.t() * v_c
if abs(v_r.x) > abs(size.x / 2.):
point.valid = False
elif abs(v_r.y) > abs(size.y / 2.):
point.valid = False
elif abs(v_r.z) > abs(size.z / 2.):
point.valid = False
else:
continue
print("Script finished. Points outside the region were removed.")
Metashape.app.addMenuItem("Scripts/Delete Points Outside Bounding Box", main)