Forum

Author Topic: Getting a markers estimated position after its been set.  (Read 2805 times)

s093294

  • Newbie
  • *
  • Posts: 23
    • View Profile
Getting a markers estimated position after its been set.
« on: October 17, 2014, 09:44:15 AM »
I would like from python to get the coordinate (world coordinate system) of the marker I just ented by right clicking in an image and create marker. (It could be just the selected marker).

For this just assume we have a marker. How do i calculate its estimated position.

I had this code from prior that took me from a world coordinate to pixel coordinate.

currentChunk  = PhotoScan.app.document.activeChunk
point_geocentric = currentChunk.projection.unproject(PhotoScan.Vector((676762.785,6123462.136,30)))
point_geocentric.size = 4
point_geocentric[3] = 1

a_camera = currentChunk.cameras[0];
transform_matrix = currentChunk.transform * a_camera.transform
point_local = transform_matrix.inv() * point_geocentric
point_local.size = 3
(image_x, image_y) = a_camera.project(point_local)

So basicly I would want to do it the reverse instead.


transform_matrix = chunk.transform * camera.transform
point = PhotoScan.Vector([6886,46])
local = camera.unproject(point)
geocentric = transform_matrix * local;

but the problem is that there is no such thing as camera.unproject

I am fine with an assumption that the image region is a estimate flat surface and estimating the height of the camera so i tried this:

point = PhotoScan.Vector([6886,46])
point1 = camera.calibration.unproject(point)
point1*1800 //my estimated height of 1800.

Vector([816.3781192185984, -612.216430096838, 1800.0])

This means that the marker is placed estimated 800 x -600 meters from camera. I am getting alittle stuck here, not sure if this is the way to go.

I basicly just want to be able to write out estimated world coordinate from a marker thats not yet been given a coordinate such I can look up the precise location in GIS application