Dear Alex,
Thank you very much for your response. Actually, I need only four GCP. Then I process the python code to input the coordinate. I will show you the code and figure. First I rename the the GCP by sorting the coordinate. Then I put the coordinate depend on the label. If the gray flag occur, it is error on my algorithm. Therefore, It should be delete the gray flag by wrong detection. Alternatively, do you have any suggestion if I want only put the coordinate only 4 GCP in the cross code and disable or remove any wrong marker detection. thank you very much.
Best Regards,
LYHOUR
#---- rename the maker corresponding to coordinate by sort algorithm
xy_coord = list()
for marker in chunk.markers:
x_tmp,y_tmp,z_tmp = chunk.crs.project(chunk.transform.matrix.mulp(marker.position))
xy_coord.append([x_tmp,y_tmp])
tmp_coord = sorted(xy_coord, key=lambda k: [k[0], k[1]]) # sort coordinate base on x axis first.
k = 0
for i in range(len(tmp_coord)):
k += 1
for marker in chunk.markers:
x,y,z = chunk.crs.project(chunk.transform.matrix.mulp(marker.position))
if x == tmp_coord[i][0] and y == tmp_coord[i][1]:
marker.label = "gcp" + str(k)
break
#----- input the coordinate to the reference
for marker in chunk.markers:
if marker.label == "gcp1":
marker.reference.location = Metashape.Vector([0,0,0])
marker.reference.accuracy = Metashape.Vector([0.01,0.01,0.01])
marker.reference.enabled = True
elif marker.label == "gcp2":
marker.reference.location = Metashape.Vector([250,0,0])
marker.reference.accuracy = Metashape.Vector([0.01,0.01,0.01])
marker.reference.enabled = True
elif marker.label == "gcp3":
marker.reference.location = Metashape.Vector([0,250,0])
marker.reference.accuracy = Metashape.Vector([0.01,0.01,0.01])
marker.reference.enabled = True
elif marker.label == "gcp4":
marker.reference.location = Metashape.Vector([250,250,0])
marker.reference.accuracy = Metashape.Vector([0.01,0.01,0.01])
marker.reference.enabled = True