Forum

Author Topic: Getting projection error of markers  (Read 2381 times)

Seb_B

  • Newbie
  • *
  • Posts: 33
    • View Profile
Getting projection error of markers
« on: March 24, 2015, 12:43:36 AM »
Hello,

How can we have the error (in pixel) of the markers after the aligning step?
Something like :
marker=chunk.markers[1]
marker.projections.error         ->wrong
« Last Edit: March 24, 2015, 10:56:46 AM by Seb_B »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 9490
    • View Profile
Re: Getting projection error of markers
« Reply #1 on: March 24, 2015, 12:27:09 PM »
Hello Sebastien,

You need to calculate the errors manually, by projecting the 3D point (marker.position) on the corresponding images and then calculate the difference in pixels between projected point coordinates and original marker projection.
Best regards,
Alexey Pasumansky,
AgiSoft LLC

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 9490
    • View Profile
Re: Getting projection error of markers
« Reply #2 on: March 24, 2015, 01:27:52 PM »
For example, for single projection of marker on the give photo:
Code: [Select]
marker = chunk.markers[0]
photo = chunk.cameras[0]

v_proj = marker.projections[photo].coord #2 dimensional vector of the marker projection on the photo
v_reproj = photo.project(marker.position) #2 dimensional vector of projected 3D marker position

diff = (v_proj - v_reproj).norm() #reprojection error for current photo
Best regards,
Alexey Pasumansky,
AgiSoft LLC

mauchi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Getting projection error of markers
« Reply #3 on: November 08, 2015, 08:40:01 PM »
Hi Alexey,

Forgive the late joining to this discussion. Is there a way to export the data from python like there is in the gui? I am having the same problem where some of my markers have errors but with 144 cameras to sort through for each it would be ideal to have access to the data that is already in agisoft.

Thank you!

Mauchi
Pixelgun


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 9490
    • View Profile
Re: Getting projection error of markers
« Reply #4 on: November 09, 2015, 06:28:03 PM »
Hello Mauchi,

What information do you wish to be exported? Source/estimated values, reprojection error of each marker for every camera?
Best regards,
Alexey Pasumansky,
AgiSoft LLC

Yoann Courtois

  • Sr. Member
  • ****
  • Posts: 263
  • Engineer in Geodesy, Cartography and Surveying
    • View Profile
Re: Getting projection error of markers
« Reply #5 on: November 06, 2018, 01:02:07 PM »
Hi !

Is there a new way to export reprojection error in pixel with 1.4 API ?

Regards
--
Yoann COURTOIS
R&D Engineer in photogrammetric process and mobile application
Lyon, FRANCE
--

Yoann Courtois

  • Sr. Member
  • ****
  • Posts: 263
  • Engineer in Geodesy, Cartography and Surveying
    • View Profile
Re: Getting projection error of markers
« Reply #6 on: November 06, 2018, 01:18:01 PM »
This reprojection error could be add to such process to export "all in one" about markers

Hello ARF__,

You can try the following for the active chunk (if projected coordinate system is used):

Code: [Select]
import PhotoScan

chunk = PhotoScan.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)
« Last Edit: November 06, 2018, 01:20:53 PM by Yoann Courtois »
--
Yoann COURTOIS
R&D Engineer in photogrammetric process and mobile application
Lyon, FRANCE
--

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 9490
    • View Profile
Re: Getting projection error of markers
« Reply #7 on: November 06, 2018, 04:22:52 PM »
Hello Yoann,

Doesn't this code work in 1.4 to display RMSE for the marker reprojection erro?

Code: [Select]
import math
total =0
num = 0
for camera in chunk.cameras:
    if not camera in marker.projections.keys():
        continue
    v_proj = marker.projections[camera].coord #2 dimensional vector of the marker projection on the photo
    v_reproj = camera.project(marker.position) #2 dimensional vector of projected 3D marker position

    diff = (v_proj - v_reproj).norm() #reprojection error for current photo
    total += diff ** 2
    num +=1
print(math.sqrt(total / num))

Best regards,
Alexey Pasumansky,
AgiSoft LLC

Yoann Courtois

  • Sr. Member
  • ****
  • Posts: 263
  • Engineer in Geodesy, Cartography and Surveying
    • View Profile
Re: Getting projection error of markers
« Reply #8 on: November 06, 2018, 04:44:38 PM »
Perfect !  8)
Thanks
--
Yoann COURTOIS
R&D Engineer in photogrammetric process and mobile application
Lyon, FRANCE
--