I'm trying to achieve two coordinate conversions:
1. Using (x, y) from a photo, determine the corresponding (lng, lat) coordinates.For this part, I believe the code posted here
http://www.agisoft.com/forum/index.php?topic=7446.0 should work:
chunk = PhotoScan.app.document.chunk
camera = chunk.cameras[0]
point2D = PhotoScan.Vector([imgX,imgY]) # coordinates of the point on the given photo
sensor = camera.sensor
calibration = sensor.calibration
x = chunk.point_cloud.pickPoint(camera.center, camera.transform.mulp(sensor.calibration.unproject(point2D)))
adding
result = chunk.crs.project(x)
I can't find the "pickPoint" function in the API Reference document, but would this return the expected result?
2. Using a (lng, lat) to determine the corresponding (x, y) pixel coordinates in each photo of the project.For this case, I was thinking on creating a Marker to simplify the code
chunk = PhotoScan.app.document.chunk
pointWorld2D = PhotoScan.Vector([lng, lat])
x = crs.unproject(pointWorld2D)
chunk.addMarker(point = x)
and then loop over "marker.projections" to obtain the (x, y) pairs for each camera.
Am I on the correct path?
Thanks!
P.S: This post also gave me a couple of clues:
http://www.agisoft.com/forum/index.php?topic=6053.msg29355#msg29355