Hello callahb,
I've got it working in the following way. So when calculating the point position I'm taking the camera center and adding the depth distance (in the internal units) along the ray from that point. Also I've added print statement for the distance between the estimated locations of marker and camera:
#Compare Marker Coords Calculated from Depth Versus Estimated From Model Alignment
import PhotoScan
chunk = PhotoScan.app.document.chunk #active chunk
T = chunk.transform.matrix
scale = chunk.transform.scale
camera = chunk.cameras[0] #first camera in the chunk
depth = chunk.model.renderDepth(camera.transform, camera.sensor.calibration) #unscaled depth
depth_scaled = PhotoScan.Image(depth.width, depth.height, " ", "F32")
v_min = 10E10
v_max = -10E10
#create array of distance values
for y in range(depth.height):
for x in range(depth.width):
depth_scaled[x,y] = (depth[x,y][0] * scale, )
marker = chunk.markers[0] #first marker
x0, y0 = marker.projections[camera].coord
image_x = int(x0) #marker pixel coords in first camera
image_y = int(y0)
depth = depth_scaled[image_x,image_y][0] #marker distance from camera in meters
print("depth: " + str(depth))
vect = T.mulv(camera.center - marker.position) * scale
vect = vect.norm() #distance between estimated positions in meters
print("distance_est: " + str(vect))
cam_matrix = camera.transform
cam_calib = camera.sensor.calibration
chunk_matrix = chunk.transform.matrix
point_2D = PhotoScan.Vector([image_x, image_y])
vect = cam_calib.unproject(point_2D) #vector in camera crs
ray = cam_matrix.mulv(vect) #ray in chunk crs
point_chunk = camera.center + ray * depth / scale #find point
point_geoc = chunk_matrix.mulp(point_chunk)
point_crs = chunk.crs.project(point_geoc)
print ('point_crs: ',point_crs)
marker_est = chunk.crs.project(chunk_matrix.mulp(marker.position)) #compute projected coordinates (estimated)
print ('Estimated marker crs coords: ',marker_est)