Hi all,
for each point_id in points = chunk.point_cloud.points the cov matrix is given in the internal coordinate system. To get the cov matrix in LSE CS (localEast, Localnorth, Up) with origin at center of chunk.region, by using propagation of variance-covariance law:
cov = points[point_id].cov
cov = R * cov * R.t()
where R is determined by:
M = chunk.transform.matrix
s = chunk.transform.scale
chunk.resetRegion()
m = chunk.crs.localframe(M.mulp(chunk.region.center))
T = m * M
R = s * T.rotation()
Now the transformed cov is a 3 x 3 matrix so exporting it as a scalar field would be problem...you could just export the vector field (Sx, Sy, Sz) using the sqrt of diagonal elements of transformed cov matrix.
For example relevant cov matrix for first point in chunk.point_cloud.points would be:
points[0].cov # covariance matrix in internal CS
Out[7]: 2021-01-27 13:22:44
2021-01-27 13:22:44 Matrix([[3.0006225415490917e-07, -1.619653744455718e-07, -4.6811774723209965e-07],
2021-01-27 13:22:44 [-1.619653744455718e-07, 6.674043220300518e-07, 1.1982299383817008e-06],
2021-01-27 13:22:44 [-4.6811774723209965e-07, 1.1982299383817008e-06, 3.727560169863864e-06]])
R * points[0].cov * R.t() # covariance matrix in LSE CS with origin at chunk region center
Out[8]: 2021-01-27 13:22:56
2021-01-27 13:22:56 Matrix([[0.0025407878501558807, 0.0007874548004021441, -0.004730312985074604],
2021-01-27 13:22:56 [0.000787454800402144, 0.0014958743002914435, -0.002598802301929944],
2021-01-27 13:22:56 [-0.004730312985074604, -0.0025988023019299436, 0.01712588634164101]])