Forum

Author Topic: Camera coordinate (x, y) to Orthomosaic coordinate (x, y)  (Read 1386 times)

willcodeforfoo

  • Newbie
  • *
  • Posts: 13
    • View Profile
Camera coordinate (x, y) to Orthomosaic coordinate (x, y)
« on: May 31, 2022, 05:31:21 PM »
Is it possible (maybe through pickPoint, camera.transform, etc.) to somehow determine which x, y coordinate in the orthomosaic corresponds to a given camera's x, y coordinate (if any?)

Thanks!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14843
    • View Profile
Re: Camera coordinate (x, y) to Orthomosaic coordinate (x, y)
« Reply #1 on: May 31, 2022, 06:43:29 PM »
Hello willcodeforfoo,

Can you please specify, if you mean pixels for XY orthomosaic coordinates, or whether X and Y are in geographic/local coordinates?

Also specify, whether the surface used for the orthomosaic generation is available (may be required to estimate Z value for the point of interest), and which projection method is used for orthomosaic generation.
Best regards,
Alexey Pasumansky,
Agisoft LLC

willcodeforfoo

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Camera coordinate (x, y) to Orthomosaic coordinate (x, y)
« Reply #2 on: May 31, 2022, 10:44:31 PM »
Alexey, Thanks for the reply!

Ortho would be generated in geographic projection with WGS84 from DEM and I'm interested in the XY coordinates in the ortho, not really interested in Z.

Paulo

  • Hero Member
  • *****
  • Posts: 1320
    • View Profile
Re: Camera coordinate (x, y) to Orthomosaic coordinate (x, y)
« Reply #3 on: June 01, 2022, 02:40:48 PM »
Hello will,

Given a chunk with a given camera with a point with (x,y) pixel coordinates then you can use the surface that was the base for DEM generation

surface = chunk.model or surface = chunk.dense_cloud
so projected point p on surface woud be
p = surface.pickPoint(center,p2) # projected point p on surface in internal coordinate system
where center = camera.unproject(ps.Vector((x,y,0))) # camera perspective center coordinates in internal CS and
p2 = camera.unproject(ps.Vector((x,y,1))) # coordinates of point in direction from (x,y) to camera center in internal CS

P = ortho.crs.project(T.mulp(p)) # coordinates of projected point in ortho projection
X, Y  = (P.x, P.y) # point P X,Y coordimates  in ortho CS
where ortho = chunk.orthomosaic and T = chunk.transform.matrix

This should get you going,

PS this supposes projected point on surface exists ie. is inside same
« Last Edit: June 01, 2022, 05:13:32 PM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor