Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - masopiq

Pages: [1]
Python and Java API / Select Camera by polygon
« on: June 19, 2024, 08:43:28 AM »
Please help me to fix thos code to select camera inside polygon, i am running Metashape 2.1 :

#import Metashape

def point_inside(point, poly):

   x, y = point.x, point.y
   inside = False

   p1x, p1y = poly[0]
   for i in range(len(poly) + 1):
      p2x, p2y = poly[i % len(poly)]
      if y >= min(p1y, p2y):
         if y <= max(p1y, p2y):
            if x <= max(p1x, p2x):
               if p1y != p2y:
                  xinters = (y - p1y) * (p2x - p1x) / (p2y - p1y) + p1x
               if p1x == p2x or x <= xinters:
                  inside = not inside
      p1x, p1y = p2x, p2y
   return inside

doc =
chunk = doc.chunk
shapes = chunk.shapes
crs =
T = chunk.transform.matrix
polygons = dict()

for shape in shapes:
   if not shape.selected: #skipping not selected shapes
   if shape.geometry.type == Metashape.Geometry.PolygonType:
      polygons[shape] = [[v.x, v.y] for v in shape.geometry.coordinates[0]]
for camera in chunk.cameras:
   camera.selected = False
   if not camera.transform:
      if camera.reference.location:
         camera_coord = crs.project(
      camera_coord = crs.project(T.mulp(
   for shape in polygons.keys():
      if point_inside(Metashape.Vector([camera_coord.x, camera_coord.y]), polygons[shape]):
         camera.selected = True
print("Script finished")

General / Mavic 2 Pro DEM result out of
« on: October 19, 2023, 03:58:01 PM »
I hope someone could help me..
I did aerial mapping with Mavic 2 Pro to get contour, my flight setting altitude 220m, speed 12 m/s, overlap 80% sidelap 60%. DEM result have difference elevation about 1-3 meter even if at GCP. Iam using 5 GCP for and already enable full rolling shutter compensation before align...
Is there any missing step in processing ?

Thanks in advance

General / Ground Resolution of Orthomosaic
« on: October 06, 2016, 04:26:16 AM »
In building orthomosaic I got resolution 9.83cm/pix. But, in report ground resolution increase to 10.3cm/pix. How could it different?
Orthomosaic build from sparse cloud, and I din't build dense cloud..


General / Aligning single flight line, i.e. Pipe or road
« on: December 29, 2015, 12:47:13 PM »
It is possible to process orthomosaic from single flight line photos (with 80% overlap), for example in pipeline monitoring or road mapping?


General / Re: ortho error after georeferenced
« on: May 08, 2015, 01:33:01 PM »
Thanks Alex,
It's mean, there is no any action in PS to solve it...unless I take photo again
Is blurred photo will affect the mosaic/aligning result and could produce spike?


General / Re: ortho error after georeferenced
« on: May 08, 2015, 11:59:52 AM »
please find screenshoot of GCP residues.
The coordinate system is correct at UTM Zone 50S.

General / Re: ortho error after georeferenced
« on: May 06, 2015, 02:55:47 AM »
Hello masopiq,

I also ask you to provide some screenshots demonstrating the problem.

Please find the attachment. thanks

General / ortho error after georeferenced
« on: May 05, 2015, 04:23:53 PM »
I have done aligning process in PS and resulting bowl effect orthophoto. After I use GCP from static GPS measurement to georeference the ortho, the DSM/ortho goes strange. Some area have error in elevation and sometimes produce spike.
I have try to reprocess from the start, and the problem still occurs.
Please help me to solved it. Thanks in advance

Pages: [1]