Forum

Author Topic: How to remove gray flag from the marker detection  (Read 1745 times)

lyhour

  • Newbie
  • *
  • Posts: 41
    • View Profile
How to remove gray flag from the marker detection
« on: February 09, 2022, 10:03:48 AM »
Excuse me everyone! I am using Autodetection Marker to detect the GCP with cross code (non code) as show in the figure. It work well for detection the GCP. However, it is over detection (gray flag) with non corresponding to the GCP. Therefore, How can i remove it using the python code ? Thank you very much.

Best Regards,
LYHOUR

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14890
    • View Profile
Re: How to remove gray flag from the marker detection
« Reply #1 on: February 09, 2022, 01:21:05 PM »
Hello lyhour,

Gray flags are not considered during the processing. They are only shown for the user convenience - for better understanding of the 3D point location, based on the marker projections defined on other images.
Best regards,
Alexey Pasumansky,
Agisoft LLC

lyhour

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: How to remove gray flag from the marker detection
« Reply #2 on: February 09, 2022, 03:25:51 PM »
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

Code: [Select]
#---- 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

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14890
    • View Profile
Re: How to remove gray flag from the marker detection
« Reply #3 on: February 09, 2022, 03:46:44 PM »
Hello lyhour,

If you remove all "blue" and "green" projections for point5, point6 and point7 (and also uncheck the marker in the reference pane) - gray flags will disappear automatically.

Gray flags indication only exist if there are at least two projections for the related markers, defined on the aligned images.
Best regards,
Alexey Pasumansky,
Agisoft LLC

lyhour

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: How to remove gray flag from the marker detection
« Reply #4 on: February 09, 2022, 03:53:58 PM »
Dear Alex,

Please apology, I am not so clear what you mentioned. If I am not confuse, the process you mentioned is conducted on the GUI. However, If I want to do in python code, how can I do it ? Because I generate the model using only Python.

Best Regards,

LYHOUR

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14890
    • View Profile
Re: How to remove gray flag from the marker detection
« Reply #5 on: February 09, 2022, 04:45:43 PM »
Hello lyhour,

I can suggest to improve your algorithm by trying to create the convex polygon from the available markers. If the erroneous marker detections are usually in the middle of scene, you should get 4-vertex polygon (each vertex corresponding to your "gcp"s), thus you can remove all the other markers from the chunk, before assigning labels and coordinates to the correctly detected markers.
Best regards,
Alexey Pasumansky,
Agisoft LLC

lyhour

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: How to remove gray flag from the marker detection
« Reply #6 on: February 09, 2022, 04:55:26 PM »
Dear Alex,

Thank you very much for your suggestion. I have no idea how to create the polygon from the maker. It would be better if you could show me some coding or documentation to create this. I am sorry about your inconvenience.

Best Regards,
LYHOUR

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14890
    • View Profile
Re: How to remove gray flag from the marker detection
« Reply #7 on: February 09, 2022, 05:26:28 PM »
Hello lyhour,

You do not need to create the polygon from marker.

I meant to analyze the list of (X, Y) coordinates - find the max possible convex polygon formed from that list (should have 4 vertices), then keep only markers related to the detected 4 vertices of the imaginary polygon and remove the others.
Best regards,
Alexey Pasumansky,
Agisoft LLC