Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: Seb_B 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
-
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.
-
For example, for single projection of marker on the give photo:
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
-
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
-
Hello Mauchi,
What information do you wish to be exported? Source/estimated values, reprojection error of each marker for every camera?
-
Hi !
Is there a new way to export reprojection error in pixel with 1.4 API ?
Regards
-
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):
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)
-
Hello Yoann,
Doesn't this code work in 1.4 to display RMSE for the marker reprojection erro?
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))
-
Perfect ! 8)
Thanks