Commit 24822ed2 authored by Patrick Snape's avatar Patrick Snape Committed by Facebook GitHub Bot
Browse files

Define undistort as pinhole projection

Summary:
Currently on master we have a bug in that we undistort images into a pinhole frame but then optimize in Rosetta using fisheye. Undistorting to pinhole is totally fine but then we should be optimizing in pinhole in Rosetta.

So this is the "other" version of the fix I did in D58979100. In D58979100 I "fixed" the cameras by defining the undistort method to be fisheye rather than pinhole. In this diff I did the other way round - I've left the CameraOperator alone and I've fixed the distortion model we propagate after undistortion to be pinhole.

Reviewed By: AlexRadionovMeta

Differential Revision: D60927099

fbshipit-source-id: 316aa0d99396c49d61c31d743112f1aa0eef85cb
parent b91ae53d
......@@ -11,6 +11,7 @@ import torch as th
DISTORTION_MODES: Set[Optional[str]] = {
None,
"pinhole",
"radial-tangential",
"fisheye",
}
......@@ -359,7 +360,7 @@ def project_points(
elif len(modes) == 1:
distortion_mode = modes[0]
if distortion_mode is None:
if distortion_mode is None or distortion_mode == "pinhole":
v_pix = project_pinhole(v_cam, focal, princpt)
elif isinstance(distortion_mode, str):
assert distortion_coeff is not None
......@@ -391,9 +392,10 @@ def project_points(
f"Invalid distortion mode: {distortion_mode}. Valid options: {DISTORTION_MODES}."
)
v_pix = th.empty_like(v_cam[..., :2])
if None in modes:
if None in modes or "pinhole" in modes:
idx = th.tensor(
[mode is None for mode in distortion_mode], device=v_pix.device
[mode is None or mode == "pinhole" for mode in distortion_mode],
device=v_pix.device,
)
v_pix[idx] = project_pinhole(v_cam[idx], focal[idx], princpt[idx])
if "radial-tangential" in modes:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment