Forum

Author Topic: Marker errors are large.  (Read 2536 times)

Aravinth

  • Newbie
  • *
  • Posts: 18
    • View Profile
Marker errors are large.
« on: January 19, 2020, 05:40:16 PM »
Hello Everyone,
                            I have used the projected markers and the GCP's to get the error of markers. I have used ETRS89 / UTM zone 32N (N-E) (EPSG::3044) coordinate system. But I get a huge error. I have also attached the code for projecting marker and to get the error. Kindly help me to reduce the error of the markers projected. Thank you.

Code: [Select]
ch = Metashape.app.document.chunk

chunk = Metashape.app.document.chunk
out_crs = Metashape.CoordinateSystem("EPSG::3044")
for camera in chunk.cameras:
    if camera.reference.location:
        camera.reference.location = Metashape.CoordinateSystem.transform(camera.reference.location, chunk.crs, out_crs)
for marker in chunk.markers:
    if marker.reference.location:
        marker.reference.location = Metashape.CoordinateSystem.transform(marker.reference.location, chunk.crs, out_crs)
chunk.crs = out_crs


# file = open('C:\\Program Files\\Agisoft\\Metashape Pro', "markers_projections_rgb_center.txt") #input file
file = open("marker_center_A_Manual.txt") #input file
eof = False
line = file.readline()
if not len(line):
eof = True
while not eof:
sp_line = line.rsplit(",", 3)   #splitting read line by four parts
y = float(sp_line[3]) #y- coordinate of the current projection in pixels
x = float(sp_line[2]) #x- coordinate of the current projection in pixels
path = sp_line[0] #camera label
marker_name = sp_line[1] #marker label
flag = 0
for i in range (len(ch.cameras)):

if ch.cameras[i].label == path: #searching for the camera

for j in range (len(ch.markers)): #searching for the marker (comparing with all the marker labels in chunk)
if ch.markers[j].label == marker_name:
ch.markers[j].projections[ch.cameras[i]] = Metashape.Marker.Projection(Metashape.Vector([x,y]), True) #setting up marker projection of the correct photo)
flag = 1
break

if not flag:
marker = ch.addMarker()
marker.label = marker_name
marker.projections[ch.cameras[i]] =  Metashape.Marker.Projection(Metashape.Vector([x,y]), True)
break

line = file.readline() #reading the line from input file
if not len(line):
eof = True
break # EOF
file.close()


doc = env.app.document
env_type = 1
#chunk = env.app.document.chunk
#chunk = env.app.document.addChunk()
chunk = Metashape.app.document.chunk
path = "C:\\Program Files\\Agisoft\\Metashape Pro\\ipi-measurement-gcp.txt"
chunk.importReference(path, format = env.ReferenceFormatCSV, delimiter=",", columns="nxyz", create_markers=True)

chunk = Metashape.app.document.chunk

for marker in chunk.markers:
      source = marker.reference.location
      estim = chunk.crs.project(chunk.transform.matrix.mulp(marker.position))
      error = estim - source
      total = error.norm()
      print(marker.label, error.x, error.y, error.z, total)




Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Marker errors are large.
« Reply #1 on: January 19, 2020, 08:11:33 PM »
Hello Aravinth,


Does it help, if you use chunk.updateTransform() after loading the coordinates of the markers from CSV file?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Aravinth

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Marker errors are large.
« Reply #2 on: January 20, 2020, 02:12:15 PM »
Dear Alexy,
 I don't have a CSV file for the markers. I Have manually placed marker text file and the GCP textfile provided to me by the guide. Do I need a csv file for the manually placed markers. 

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Marker errors are large.
« Reply #3 on: January 20, 2020, 02:15:48 PM »
Hello Aravinth,

Can you please provide the original project (before applying the script) and the project saved after applying the script to support@agisoft.com together with all the external text file which are used by the script?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Aravinth

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Marker errors are large.
« Reply #4 on: January 20, 2020, 02:23:57 PM »
Dear Alexy,
I have used chunk.updateTransform() the errors are reduced but not till the centimetre level. I have a total error of 15 m. What can I do now to reduce them.

Aravinth

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Marker errors are large.
« Reply #5 on: January 20, 2020, 02:25:02 PM »
Dear Alexey,
Sure I will send you the files.

Aravinth

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Marker errors are large.
« Reply #6 on: January 20, 2020, 02:52:21 PM »
Dear Alexey,
                     I have sent all the essential files to the support@agisoft.com. Kindly have a look at it. Thank you

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Marker errors are large.
« Reply #7 on: January 20, 2020, 06:25:29 PM »
Hello Aravinth,

It seems that the marker labels are mixed and the coordinate information is loaded for incorrect markers.
In the CSV file with 3D coordinates of the markers you should apply the following modifications:
point 1 -> point 5
point 2 -> point 3
point 3 -> point 4
point 4 -> point 6
point 5 -> point 2
point 6 -> point 1
Then re-import the coordinate information to the project.

Also please remove the projection of the Point 6 from the image RGB_0078 - it seems to appear there by mistake, since projection of the proper marker (point 5) is already there in the very same point.

You just need to remove the projection information for "point 6" from the image RGB_0078, as it is incorrect (the proper point 5 projection is already there).


Also I recommend to uncheck all cameras in the Reference pane, as the altitude information for them is incorrect - cameras should be about 190 meters higher than values loaded to the Reference pane.
« Last Edit: January 20, 2020, 06:50:27 PM by Alexey Pasumansky »
Best regards,
Alexey Pasumansky,
Agisoft LLC