1
General / Re: Any tips to use images as GCP
« on: May 02, 2020, 03:18:05 PM »
A bit later, but thank you very much!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
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 = {}
photo_info=[[float('nan') for j in range(3)] for i in range(len(chunk.cameras))]#Ajout seb
i=-1
#print("total camera number: ",len(chunk.cameras))
for camera in chunk.cameras:
i+=1
if not camera.transform:
photo_info[i]=[camera,float('nan'),float('nan')]
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 = calib.error(T.mulp(points[point_index].coord), proj.coord).norm() ** 2
err_sum += dist
num += 1
photo_num += 1
photo_err += dist
#Ajout seb
#print("i:",i)
if photo_num==0:
photo_info[i]=[camera,photo_num,float('nan')]
else:
photo_info[i]=[camera,photo_num,math.sqrt(photo_err / photo_num)]
return photo_info