Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: Phogi on November 22, 2019, 06:48:04 AM

Title: Help in localframe explain
Post by: Phogi on November 22, 2019, 06:48:04 AM
Hi everyone,

Could anyone give some hints about the chunk.crs.localframe() matrix?
Hello claranine,

Code: [Select]
sourceGeogr = camera.reference.location #source values in geographic coordinate system
estGeogr = chunk.crs.project(chunk.transform.matrix.mulp(camera.center)) #estimated position in geographic coordinate system

sourceGeoc = chunk.crs.unproject(camera.reference.location) #measured values in geocentric coordinates
estimGeoc = chunk.transform.matrix.mulp(camera.center) #estimated coordinates in geocentric coordinates
local = chunk.crs.localframe(chunk.transform.matrix.mulp(camera.center)) #local LSE coordinates
error = local.mulv(estim - source)

As in this post why the error needs to use local.mulv to transform rather than directly use (estim - source)? Is this due to unit difference?

Thanks in advance!
Title: Re: Help in localframe explain
Post by: Phogi on December 02, 2019, 09:49:55 AM
Aha I generally got the answer from different threads, since the camera errors need to be calculated in the same unit, while if directly subtract estim position to source position they can be degrees which is not correct. In localframe I suppose the unit is meter, then can scale to other unit if needed?
Title: Re: Help in localframe explain
Post by: Alexey Pasumansky on December 04, 2019, 07:45:50 PM
Hello Phogi,

localframe coordinates are in meters, if you need to scale the errors to different units, you need to use the unit scale definition. Usually the number is available in the crs.wkt line.
Title: Re: Help in localframe explain
Post by: Phogi on December 06, 2019, 08:42:18 AM
Thank you Alexey!

I got another question, could you help to identify?
I found
camera.project(chunk.markers[0].position)
and
markers[0].projections[camera].coord
both can return the x/y of the image pixels, but they are different, could you tell me which one should be the correct one?

Thanks!
Title: Re: Help in localframe explain
Post by: Alexey Pasumansky on December 06, 2019, 01:18:29 PM
Hello Phogi,

camera.project returns the 2D projection of the given 3D point in the image frame coordinates. Whereas marker.projections[camera] returns the position of the marker projection (green/blue flag) on the related image. The difference between these values should correspond to the reprojection error for the marker on the given image.

To camera.project method you can pass any 3D point (in the internal chunk's coordinate system).