Author Topic: Merge markers after detection!!  (Read 330 times)


  • Newbie
  • *
  • Posts: 3
    • View Profile
Merge markers after detection!!
« on: December 17, 2018, 05:59:49 PM »
Hello !

Would it be possible to merge markers after they've been detected ?

i.e. Does it exist something to create a marker that gather the projections of two (or more) markers that have been automatically detected ?

Indeed, after non-coded target detection (circle), I got several markers really close to each other (less than a centimeter) coming from the detection of an unique object. And at this point I don't know how to gather all the projections into a single marker.
« Last Edit: December 17, 2018, 11:01:24 PM by williamgomes »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10302
    • View Profile
Re: Merge markers after detection!!
« Reply #1 on: December 17, 2018, 07:00:56 PM »
Hello williamgomes,

Please try this script, it works, however, in semi-manual way - you need to select the markers that you wish to merge at first, then execute the script (from the Custom Menu):
Code: [Select]
import PhotoScan

def merge_selected_markers():

doc =
chunk = doc.chunk
print("Script started...")
merge_list = list()

for marker in chunk.markers:
if marker.selected:
if len(merge_list) < 2:
print("Nothing to merge, script aborted.")
return False
print(str(len(merge_list)) + " markers found.\nMerging projections")

ref_marker = merge_list[0]
projections = dict()
for marker in merge_list:
for camera in list(marker.projections.keys()):
if camera not in projections.keys():
projections[camera] = PhotoScan.Vector([0,0, 0])
x = marker.projections[camera].coord
x.size = 3
x.z = 1
projections[camera] += x
marker.projections[camera] = None
for camera in projections.keys():
if projections[camera].z:
ref_marker.projections[camera] = PhotoScan.Marker.Projection(PhotoScan.Vector([projections[camera].x, projections[camera].y]) * (1 /  projections[camera].z), True)
print("Script finished")
return True"Custom menu/Merge Selected Markers", merge_selected_markers)
Best regards,
Alexey Pasumansky,
AgiSoft LLC