Forum

Author Topic: Extracting Errors and Accuracies  (Read 5217 times)

christian.seitz

  • Newbie
  • *
  • Posts: 1
    • View Profile
Extracting Errors and Accuracies
« on: November 06, 2015, 04:19:57 PM »
Hello,

I'm trying to get the Errors (North/East/Z) and Accuracies for each camera automatically exported in a csv using Python. So far I found the solution presented here - but this doesn't work with 1.2.0 (calib.error(T.mulp(p), proj.coords) is not working), though Python throws no error, just stops.

Are there any other ideas?

Best,
Christian

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15691
    • View Profile
Re: Extracting Errors and Accuracies
« Reply #1 on: November 09, 2015, 05:44:25 PM »
Hello Christian,

To estimate reprojection error in pixels you can use the following modification of the older script:

Code: [Select]
import math
import PhotoScan

def calc_reprojection(chunk):

point_cloud = chunk.point_cloud
points = point_cloud.points
npoints = len(points)
projections = chunk.point_cloud.projections

err_sum = 0
num = 0

photo_avg = {}

for camera in chunk.cameras:
if not camera.transform:
continue

T = camera.transform.inv()
calib = camera.sensor.calibration

point_index = 0

photo_num = 0
photo_err = 0
for proj in projections[camera]:
track_id = proj.track_id
while point_index < npoints and points[point_index].track_id < track_id:
point_index += 1
if point_index < npoints and points[point_index].track_id == track_id:
if not points[point_index].valid:
continue

dist = camera.error(points[point_index].coord, proj.coord).norm() ** 2

err_sum += dist
num += 1

photo_num += 1
photo_err += dist

photo_avg[camera.label] = (math.sqrt(photo_err / photo_num), photo_num)

sigma = math.sqrt(err_sum / num)


rep_avg = sigma

return (rep_avg, photo_avg)


doc = PhotoScan.app.document
chunk = doc.chunk

total_error, ind_error = calc_reprojection(chunk)
print(total_error, ind_error)

We've added camera.error() function that allows to get the reprojection error of the 3D point in a more convenient way (without use of chunk.transform matrix).
Best regards,
Alexey Pasumansky,
Agisoft LLC