class_docstr: Class to handle camera geometry.
class_docstr_tok: ["Class","to","handle","camera","geometry","."]
docstr: Returns the rays for the provided pixels.
  
  Args:
    pixels: [A1, ..., An, 2] tensor or np.array containing 2d pixel positions.
  
  Returns:
      An array containing the normalized ray directions in world coordinates.
docstr_tok: ["Returns","the","rays","for","the","provided","pixels",".","Args",":","pixels",":","[","A1",",","...",",","An",",","2","]","tensor","or","np.array","containing","2d","pixel","positions",".","Returns",":","An","array","containing","the","normalized","ray","directions","in","world","coordinates","."]
code: def pixels_to_rays(
      self, pixels: np.ndarray
  ) -> Tuple[np.ndarray, np.ndarray]:
      """Returns the rays for the provided pixels.
  
      Args:
        pixels: [A1, ..., An, 2] tensor or np.array containing 2d pixel positions.
  
      Returns:
          An array containing the normalized ray directions in world coordinates.
      """
      if pixels.shape[-1] != 2:
          raise ValueError("The last dimension of pixels must be 2.")
      if pixels.dtype != self.dtype:
          raise ValueError(
              f"pixels dtype ({pixels.dtype!r}) must match camera "
              f"dtype ({self.dtype!r})"
          )
  
      batch_shape = pixels.shape[:-1]
      pixels = np.reshape(pixels, (-1, 2))
  
      local_rays_dir = self.pixel_to_local_rays(pixels)
      rays_dir = np.matmul(
          self.orientation.T, local_rays_dir[..., np.newaxis]
      )
      rays_dir = np.squeeze(rays_dir, axis=-1)
  
      # Normalize rays.
      rays_dir /= np.linalg.norm(rays_dir, axis=-1, keepdims=True)
      rays_dir = rays_dir.reshape((*batch_shape, 3))
      return rays_dir
  
imports: import copy
  import json
  from typing import Tuple, Union, Optional
  import numpy
  from nerfies import gpath
  from nerfies import types
label_desc: Use image node_id 17 for calling the Camera obj's underlying member method code with example usage: obj.pixels_to_rays(pixels) and returns: rays_dir