Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: Darshan on December 17, 2019, 12:50:34 AM

Title: find out estimated co-ordinates for the cameras
Post by: Darshan on December 17, 2019, 12:50:34 AM

Hello

I have latitude, longitude, accuracy for the chunk which was obtained from the relative orientation of the other camera .now I want to find the estimated coordinates and the angles using agisoft python please check the screenshot. please let me know if you need any other information

Thanks
Darshan
Title: Re: find out estimated co-ordinates for the cameras
Post by: Darshan on December 17, 2019, 04:35:37 AM

Hello

I have latitude, longitude, accuracy for the chunk which was obtained from the relative orientation of the other camera .now I want to find the estimated coordinates and the angles using agisoft python please check the screenshot. please let me know if you need any other information

Thanks
Darshan

here is my code

import Metashape
import numpy

#doc = Metashape.app.document#active ch_flir

ch_flir = doc.chunks[2]
#print(ch_flir)

#x= numpy.loadtxt(open(r"C:\Users\Darshan Savanur\Downloads\project\py files\cameracenttermal1.csv","rb"), delimiter=",")

for camera in ch_flir.cameras:
   
    K = camera.reference.location
    print(K)
    cameracenter = ch_flir.crs.unproject(K)
    cameracenter = ch_flir.transform.matrix.inv().mulp(cameracenter)
   
    T = ch_flir.transform.matrix
    print(T)
    m = ch_flir.crs.localframe(T.mulp(cameracenter)) #transformation matrix to the LSE coordinates in the given point
    print(m)
    R = (m * T * camera.transform * Metashape.Matrix().Diag([1, -1, -1, 1])).rotation()
   
   
    print(T)
Title: Re: find out estimated co-ordinates for the cameras
Post by: Alexey Pasumansky on December 25, 2019, 03:49:14 PM
Hello Darshan,

Have you checked the following solution for calculation of the estimated camera locations and orientation angles:
https://agisoft.freshdesk.com/support/solutions/articles/31000145016-how-to-calculate-estimated-exterior-orientation-parameters-for-the-cameras-using-python