Hello Alexey,
I asked the question like below
"""
Hi,
##Context##
I used PhotoScan for 3D reconstruction from a sequence of spherical images. I exported the reconstructed 3D model as a 3D point cloud (.ply file) and the estimated camera poses (.xml file). I open the 3D point cloud in MeshLab and it is not straight. Part of the reasons is that the 360-degree spherical camera that we used was hand-held (so not straight). In our case, we know the vertical direction of the first image (by manual interaction with an external software), and we can compute a rotation that can map this vertical direction to the up-direction [0,0,1]. (we know the vertical direction *only* of the first image). This vertical direction is a 3D vector u=(ux,uy,uz) in the camera coordinate system (z pointing up).
##Goal##
We would like to apply this rotation (or 3D transformation) to the exported 3D point cloud using Matlab so that the 3D point cloud becomes correctly oriented (should be straight/vertical). We tried several things (we are familiar with 3D points manipulation and 3D transformations) but none of them worked. The problem seems to be in the coordinate systems of the 3D point cloud and/or the spherical cameras. Any tips?
##What we tried##
Let R and T be the rotation and translation of the first image (from the estimated camera poses in the xml file). Let Rup our rotation matrix to straight up the direction.
We tried:
- directly applying Rup (and also its inverse) to the 3D point cloud
- We applied -T (to move the 3D point cloud to the origin) and applied our Rup (and its inverse)
- we also applied R^{-1} then Rup
- we also applied -T, then R^{-1} (so that the first image has its "default" orientation" and at the origin) and then Rup (and also its inverse)
- among other things
However the resulting 3D point cloud is not straight.
Side note: we checked this rotation and it is correct: by applying this rotation to the spherical image, we can obtain a new spherical image (and its equirectangular image) which is straight.
Modify message
"""
and this is your reply
"""
Hello raehyuk,
Can you share the sample project with only alignment results in PSZ format, so that we could try to modify the chunk's coordinate system according to the first camera orientation?
Were you trying to do that (according to the latter section in your post) in Matlab only or in PhotoScan / Metashape using Python?
"""
Sorry I missed your reply.
I rotate point cloud using matlab and I am using metashape-pro (not python scripting just using gui).
This is link to the .PSZ
https://drive.google.com/file/d/13xxu80auSMp3L0bVpfYvQ9b6OB8oiapF/view?usp=sharing