CameraUtilities.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/Math/Matrix3x3.h>
  10. //! Namespace contains utility functions for camera.
  11. namespace ROS2::CameraUtils
  12. {
  13. //! Function computes aspect ratio of the image.
  14. //! @param width Width of the image in pixels
  15. //! @param height Height of the image in pixels.
  16. //! @return Aspect ratio of the image.
  17. float GetAspectRatio(float width, float height);
  18. //! Function computes 3x3 projection matrix (pinhole model) from camera config.
  19. //! @param height Height of the image in pixels.
  20. //! @param width Width of the image in pixels
  21. //! @param verticalFieldOfViewDeg Vertical field of view of the camera in degrees.
  22. //! @return projection matrix for computer vision applications.
  23. AZ::Matrix3x3 MakeCameraIntrinsics(int width, int height, float verticalFieldOfViewDeg);
  24. //! Function computes 4x4 projection matrix (frustum model) from camera config.
  25. //! @param height Height of the image in pixels.
  26. //! @param height Height of the image in pixels.
  27. //! @param verticalFieldOfViewDeg Vertical field of view of the camera in degrees.
  28. //! @param farDist Far clipping plane distance in meters.
  29. //! @param nearDist Near clipping plane distance in meters.
  30. //! @return projection matrix for the rendering.
  31. AZ::Matrix4x4 MakeClipMatrix(int width, int height, float verticalFieldOfViewDeg, float nearDist = 0.1f, float farDist = 100.0f);
  32. } // namespace ROS2::CameraUtils