"tools/git@developer.sourcefind.cn:OpenDAS/dlib.git" did not exist on "48b9bf3f93f47f6173e101bc81343d55eedf242d"
Commit 9683df26 authored by Wenjing Zhang's avatar Wenjing Zhang Committed by Facebook GitHub Bot
Browse files

propagate the lut in drtk rendering functions

Summary:
The purpos of this stack is to enable LUT in rosetta2. To do this:
1. extend project_fisheye_distort_62 to support LUT
2. propagate lut in DRTK rendering functions
3. load the LUT in HMCCalibrationSCIOVRS
4. register LUT as an asset for loading
5. extend the rendering pipeline in rosetta2 with  LUT
6. hook the care cmd string generated in fblearner pipeline with assets defined in 4.

This diff implements 2. I start from the rendering layer defined in drtk and add lut as optional defaults to None.

Reviewed By: patricksnape

Differential Revision: D68207715

fbshipit-source-id: bb9250ec13eaa78bc2615d1845a0b612fbfc12e4
parent 91635444
...@@ -74,6 +74,8 @@ def transform_with_v_cam( ...@@ -74,6 +74,8 @@ def transform_with_v_cam(
distortion_mode: Optional[Union[List[str], str]] = None, distortion_mode: Optional[Union[List[str], str]] = None,
distortion_coeff: Optional[th.Tensor] = None, distortion_coeff: Optional[th.Tensor] = None,
fov: Optional[th.Tensor] = None, fov: Optional[th.Tensor] = None,
lut_vector_field: Optional[th.Tensor] = None,
lut_spacing: Optional[th.Tensor] = None,
) -> Tuple[th.Tensor, th.Tensor]: ) -> Tuple[th.Tensor, th.Tensor]:
""" """
Same as transform, but also returns the camera-space coordinates. Same as transform, but also returns the camera-space coordinates.
...@@ -100,7 +102,16 @@ def transform_with_v_cam( ...@@ -100,7 +102,16 @@ def transform_with_v_cam(
assert princpt is not None assert princpt is not None
# Compute camera-space 3D coordinates and 2D pixel-space projections. # Compute camera-space 3D coordinates and 2D pixel-space projections.
v_pix, v_cam = project_points( v_pix, v_cam = project_points(
v, campos, camrot, focal, princpt, distortion_mode, distortion_coeff, fov v=v,
campos=campos,
camrot=camrot,
focal=focal,
princpt=princpt,
distortion_mode=distortion_mode,
distortion_coeff=distortion_coeff,
fov=fov,
lut_vector_field=lut_vector_field,
lut_spacing=lut_spacing,
) )
return v_pix, v_cam return v_pix, v_cam
...@@ -367,6 +367,8 @@ def project_points( ...@@ -367,6 +367,8 @@ def project_points(
distortion_mode: Optional[Union[List[str], str]] = None, distortion_mode: Optional[Union[List[str], str]] = None,
distortion_coeff: Optional[th.Tensor] = None, distortion_coeff: Optional[th.Tensor] = None,
fov: Optional[th.Tensor] = None, fov: Optional[th.Tensor] = None,
lut_vector_field: Optional[th.Tensor] = None,
lut_spacing: Optional[th.Tensor] = None,
) -> Tuple[th.Tensor, th.Tensor]: ) -> Tuple[th.Tensor, th.Tensor]:
"""Project 3D world-space vertices to pixel-space, optionally applying a """Project 3D world-space vertices to pixel-space, optionally applying a
distortion model with provided coefficients. distortion model with provided coefficients.
...@@ -410,9 +412,15 @@ def project_points( ...@@ -410,9 +412,15 @@ def project_points(
v_pix = project_fisheye_distort( v_pix = project_fisheye_distort(
v_cam, focal, princpt, distortion_coeff, fov v_cam, focal, princpt, distortion_coeff, fov
) )
elif distortion_mode == "fisheye62": elif distortion_mode == "fisheye62" or distortion_mode == "fisheye62_lut":
v_pix = project_fisheye_distort_62( v_pix = project_fisheye_distort_62(
v_cam, focal, princpt, distortion_coeff, fov v_cam=v_cam,
focal=focal,
princpt=princpt,
D=distortion_coeff,
fov=fov,
lut_vector_field=lut_vector_field,
lut_spacing=lut_spacing,
) )
else: else:
raise ValueError( raise ValueError(
......
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