class_docstr: Class for Pinhole Camera models.
docstr: Computes the projection matrix for the camera.
  
  Parameters:
      focal_x: float - Focal length in X direction.
      focal_y: float - Focal length in Y direction.
  
  Returns:
      torch.Tensor: The projection matrix.
docstr_tok: ["Computes","the","projection","matrix","for","the","camera",".","Parameters",":","focal_x",":","float","-","Focal","length","in","X","direction",".","focal_y",":","float","-","Focal","length","in","Y","direction",".","Returns",":","torch.Tensor",":","The","projection","matrix","."]
code: def compute_projection_matrix(
      self, focal_x: float, focal_y: float
  ) -> torch.Tensor:
      """
      Computes the projection matrix for the camera.
  
      Parameters:
          focal_x: float - Focal length in X direction.
          focal_y: float - Focal length in Y direction.
  
      Returns:
          torch.Tensor: The projection matrix.
      """
      projection = torch.tensor(
          [
              [2 * focal_x / self.width, 0, 0, 0],
              [0, -2 * focal_y / self.height, 0, 0],
              [
                  0,
                  0,
                  -(self.far + self.near) / (self.far - self.near),
                  -(2 * self.far * self.near) / (self.far - self.near),
              ],
              [0, 0, -1, 0],
          ],
          dtype=torch.float32,
          device=self.device,
      ).unsqueeze(0)
      return projection
  
imports: from abc import ABC, abstractmethod
  from typing import List
  import numpy
  import torch
label_desc: Use image node_id 3 for calling the PinholeCamera obj's underlying member method code with example usage: obj.compute_projection_matrix(focal_x, focal_y) and returns: projection