class_docstr: A class which extends Pinhole camera by considering radial, tangential and
  thin-prism distortion. For the fisheye camera model, k1, k2, ..., k_n_radial are
  polynomial coefficents to model radial distortions. Two common types of radial
  distortions are barrel and pincusion radial distortions.
  
  a = x / z, b = y / z, r = (a*a+b*b)^(1/2)
  th = atan(r)
  [x_r]  = (th+ k0 * th^3 + k1* th^5 + ...) [a/r]
  [y_r]                                     [b/r]                    [1]
  
  
  The tangential distortion parameters are p1 and p2. The primary cause is
  due to the lens assembly not being centered over and parallel to the image plane.
  tangentialDistortion = [(2 x_r^2 + rd^2)*p_0 + 2*x_r*y_r*p_1]
                         [(2 y_r^2 + rd^2)*p_1 + 2*x_r*y_r*p_0]      [2]
  where rd^2 = x_r^2 + y_r^2
  
  The thin-prism distortion is modeled with s1, s2, s3, s4 coefficients
  thinPrismDistortion = [s0 * rd^2 + s1 rd^4]
                        [s2 * rd^2 + s3 rd^4]                        [3]
  
  The projection
  proj = diag(f, f) * uvDistorted + [cu; cv]
  uvDistorted = [x_r]  + tangentialDistortion  + thinPrismDistortion [4]
                [y_r]
  f is the focal length and cu, cv are principal points in x, y axis.
class_docstr_tok: ["A","class","which","extends","Pinhole","camera","by","considering","radial",",","tangential","and","thin-prism","distortion",".","For","the","fisheye","camera","model",",","k1",",","k2",",","...",",","k_n_radial","are","polynomial","coefficents","to","model","radial","distortions",".","Two","common","types","of","radial","distortions","are","barrel","and","pincusion","radial","distortions",".","a","=","x","\/","z",",","b","=","y","\/","z",",","r","=","(","a","*","a+b","*","b",")","^","(","1\/2",")","th","=","atan","(","r",")","[","x_r","]","=","(","th+","k0","*","th^3","+","k1","*","th^5","+","...",")","[","a\/r","]","[","y_r","]","[","b\/r","]","[","1","]","The","tangential","distortion","parameters","are","p1","and","p2",".","The","primary","cause","is","due","to","the","lens","assembly","not","being","centered","over","and","parallel","to","the","image","plane",".","tangentialDistortion","=","[","(","2","x_r^2","+","rd^2",")","*","p_0","+","2","*","x_r","*","y_r","*","p_1","]","[","(","2","y_r^2","+","rd^2",")","*","p_1","+","2","*","x_r","*","y_r","*","p_0","]","[","2","]","where","rd^2","=","x_r^2","+","y_r^2","The","thin-prism","distortion","is","modeled","with","s1",",","s2",",","s3",",","s4","coefficients","thinPrismDistortion","=","[","s0","*","rd^2","+","s1","rd^4","]","[","s2","*","rd^2","+","s3","rd^4","]","[","3","]","The","projection","proj","=","diag","(","f",",","f",")","*","uvDistorted","+","[","cu",";","cv","]","uvDistorted","=","[","x_r","]","+","tangentialDistortion","+","thinPrismDistortion","[","4","]","[","y_r","]","f","is","the","focal","length","and","cu",",","cv","are","principal","points","in","x",",","y","axis","."]
docstr: Takes in 3-point ``uv_depth`` in the image plane of the camera and unprojects it
  into the reference frame of the camera.
  This function is the inverse of ``transform_points``. In particular it holds that
  
  X = unproject(project(X))
      and
  x = project(unproject(s*x))
  
  Args:
      xy_depth: points in the image plane of shape (..., 3). E.g.,
          (P, 3) or (1, P, 3) or (M, P, 3)
      world_coordinates: if the output is in world_coordinate, if False, convert to
      camera coordinate
      scaled_depth_input: False
  
  Returns:
      unprojected_points in the camera frame with z = 1
      when points take shape (P, 3) or (1, P, 3), output is (N, P, 3)
      when points take shape (M, P, 3), output is (M, P, 3)
      where N is the number of transforms, P number of point
docstr_tok: ["Takes","in","3-point","``","uv_depth","``","in","the","image","plane","of","the","camera","and","unprojects","it","into","the","reference","frame","of","the","camera",".","This","function","is","the","inverse","of","``","transform_points","``",".","In","particular","it","holds","that","X","=","unproject","(","project","(","X",")",")","and","x","=","project","(","unproject","(","s","*","x",")",")","Args",":","xy_depth",":","points","in","the","image","plane","of","shape","(","...",",","3",")",".","E.g.",",","(","P",",","3",")","or","(","1",",","P",",","3",")","or","(","M",",","P",",","3",")","world_coordinates",":","if","the","output","is","in","world_coordinate",",","if","False",",","convert","to","camera","coordinate","scaled_depth_input",":","False","Returns",":","unprojected_points","in","the","camera","frame","with","z","=","1","when","points","take","shape","(","P",",","3",")","or","(","1",",","P",",","3",")",",","output","is","(","N",",","P",",","3",")","when","points","take","shape","(","M",",","P",",","3",")",",","output","is","(","M",",","P",",","3",")","where","N","is","the","number","of","transforms",",","P","number","of","point"]
code: def unproject_points(
      self,
      xy_depth: torch.Tensor,
      world_coordinates: bool = True,
      scaled_depth_input: bool = False,
      **kwargs,
  ) -> torch.Tensor:
      """
      Takes in 3-point ``uv_depth`` in the image plane of the camera and unprojects it
      into the reference frame of the camera.
      This function is the inverse of ``transform_points``. In particular it holds that
  
      X = unproject(project(X))
          and
      x = project(unproject(s*x))
  
      Args:
          xy_depth: points in the image plane of shape (..., 3). E.g.,
              (P, 3) or (1, P, 3) or (M, P, 3)
          world_coordinates: if the output is in world_coordinate, if False, convert to
          camera coordinate
          scaled_depth_input: False
  
      Returns:
          unprojected_points in the camera frame with z = 1
          when points take shape (P, 3) or (1, P, 3), output is (N, P, 3)
          when points take shape (M, P, 3), output is (M, P, 3)
          where N is the number of transforms, P number of point
      """
      xy_depth = xy_depth.to(self.device)
      N = len(self.radial_params)
      if N == 1:
          return self._unproject_points_batch(
              self.focal[0],
              self.principal_point[0],
              self.radial_params[0],
              self.tangential_params[0],
              self.thin_prism_params[0],
              xy_depth[..., 0:2],
          )
      else:
          outputs = []
          for i in range(N):
              outputs.append(
                  self._unproject_points_batch(
                      self.focal[i],
                      self.principal_point[i],
                      self.radial_params[i],
                      self.tangential_params[i],
                      self.thin_prism_params[i],
                      xy_depth[..., 0:2],
                  )
              )
          outputs = torch.stack(outputs, dim=0)
      return outputs.squeeze()
  
file_path: pytorch3d/pytorch3d/renderer/fisheyecameras.py
imports: import math
  from typing import List, Optional, Tuple, Union
  import torch
  from pytorch3d.common.datatypes import Device
  from pytorch3d.renderer.cameras import _R, _T, CamerasBase
label_desc: Use image node_id 6 for calling the FishEyeCameras obj's underlying member method code with example usage: obj.unproject_points(xy_depth, world_coordinates, scaled_depth_input) and returns: outputs, self