upd
This commit is contained in:
18
utils/vis.py
18
utils/vis.py
@@ -7,6 +7,7 @@ import trimesh
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from utils.data_load import DataLoadUtil
|
||||
from utils.pts import PtsUtil
|
||||
from utils.pose import PoseUtil
|
||||
|
||||
class visualizeUtil:
|
||||
|
||||
@@ -33,7 +34,22 @@ class visualizeUtil:
|
||||
all_cam_axis = np.array(all_cam_axis).reshape(-1, 3)
|
||||
np.savetxt(os.path.join(output_dir, "all_cam_pos.txt"), all_cam_pos)
|
||||
np.savetxt(os.path.join(output_dir, "all_cam_axis.txt"), all_cam_axis)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_cam_pose_and_cam_axis(cam_pose, is_6d_pose):
|
||||
if is_6d_pose:
|
||||
matrix_cam_pose = np.eye(4)
|
||||
matrix_cam_pose[:3,:3] = PoseUtil.rotation_6d_to_matrix_numpy(cam_pose[:6])
|
||||
matrix_cam_pose[:3, 3] = cam_pose[6:]
|
||||
else:
|
||||
matrix_cam_pose = cam_pose
|
||||
cam_pos = matrix_cam_pose[:3, 3]
|
||||
cam_axis = matrix_cam_pose[:3, 2]
|
||||
num_samples = 10
|
||||
sample_points = [cam_pos + 0.02*t * cam_axis for t in range(num_samples)]
|
||||
sample_points = np.array(sample_points)
|
||||
return cam_pos, sample_points
|
||||
|
||||
@staticmethod
|
||||
def save_all_combined_pts(root, scene, output_dir):
|
||||
length = DataLoadUtil.get_scene_seq_length(root, scene)
|
||||
|
Reference in New Issue
Block a user