Commit 94558c3c authored by Owen Wang's avatar Owen Wang Committed by Facebook GitHub Bot
Browse files

Add distortion to renders

Summary:
Apply fisheye62 distortion to HQLP camera renders.

Visualization of results. 4 rows are in order: HMC, drtk render, pixel render, pinhole img.

https://www.internalfb.com/manifold/explorer/codec-avatars-scratch/tree/hmc_nvs/20240516_rosetta_nearfield/runs/TEST_run_hqlp_rosetta_render_ojwang_v0719_002/dome_hmc_nvs_render/MLU130_20220509--0000_codec/vrs_comparison/000002__MLU130-brows_lowered-2022-05-09-16-08-12.png

Debug distortion document, tracked the work: https://docs.google.com/document/d/1nSnFMrGWXVoICDEstpL9JZAnRtiuSMnWjnfGDzIfrNE/edit?pli=1

Reviewed By: euclid1767

Differential Revision: D58825272

fbshipit-source-id: 463f8c60014bd9cde898d72875bec49ffc75e453
parent e2744a50
...@@ -9,7 +9,11 @@ from typing import Optional, Sequence, Set, Tuple, Union ...@@ -9,7 +9,11 @@ from typing import Optional, Sequence, Set, Tuple, Union
import numpy as np import numpy as np
import torch as th import torch as th
DISTORTION_MODES: Set[Optional[str]] = {None, "radial-tangential", "fisheye"} DISTORTION_MODES: Set[Optional[str]] = {
None,
"radial-tangential",
"fisheye",
}
def project_pinhole( def project_pinhole(
...@@ -163,7 +167,7 @@ def project_fisheye_distort_62( ...@@ -163,7 +167,7 @@ def project_fisheye_distort_62(
v_cam: N x V x 3 v_cam: N x V x 3
focal: N x 2 x 2 focal: N x 2 x 2
princpt: N x 2 princpt: N x 2
D: N x 4 D: N x 8
fov: N x 1 fov: N x 1
""" """
...@@ -171,6 +175,11 @@ def project_fisheye_distort_62( ...@@ -171,6 +175,11 @@ def project_fisheye_distort_62(
# a more readible version: https://euratom-software.github.io/calcam/html/intro_theory.html # a more readible version: https://euratom-software.github.io/calcam/html/intro_theory.html
if fov is None: if fov is None:
with th.no_grad(): with th.no_grad():
# TODO: bug.
# Fisheye62 uses 8 parameters, and the first 4 can be used
# by the same FOV estimation equation as fisheye distortion.
# However, the code takes the coeffs at indices -4, -3, -2,
# -1: which take the last 4 values, instead of the first 4.
fov = estimate_fisheye_fov(D) fov = estimate_fisheye_fov(D)
z = v_cam[:, :, 2:3] z = v_cam[:, :, 2:3]
......
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