mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-28 01:47:32 +08:00
Fix extrinsic quaternions by normalizing them to unit quaternion.
This commit is contained in:
parent
2ed1f36471
commit
2dd9d96d4a
@ -165,6 +165,9 @@ def pose_encoding_to_extri_intri(
|
|||||||
quat = pose_encoding[..., 3:7]
|
quat = pose_encoding[..., 3:7]
|
||||||
fov_h = pose_encoding[..., 7]
|
fov_h = pose_encoding[..., 7]
|
||||||
fov_w = pose_encoding[..., 8]
|
fov_w = pose_encoding[..., 8]
|
||||||
|
# Normalize to unit quaternion. CameraDec outputs raw values; a near-zero
|
||||||
|
# quaternion causes two_s = 2/norm² → inf in quat_to_mat → NaN extrinsics.
|
||||||
|
quat = quat / quat.norm(dim=-1, keepdim=True).clamp(min=1e-6)
|
||||||
R = quat_to_mat(quat)
|
R = quat_to_mat(quat)
|
||||||
extrinsics = torch.cat([R, T[..., None]], dim=-1)
|
extrinsics = torch.cat([R, T[..., None]], dim=-1)
|
||||||
H, W = image_size_hw
|
H, W = image_size_hw
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user