EquirectangularToFovBase.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // EquirectangularToFov.h
  2. // equirectangular to field of view conversion
  3. #ifndef __EQUIRECTANGULARTOFOVBASE_H__
  4. #define __EQUIRECTANGULARTOFOVBASE_H__
  5. #include "../arffHelper/Arff.h"
  6. #include "Types.h"
  7. #include <vector>
  8. using namespace std;
  9. class EquirectangularToFovBase
  10. {
  11. //Q_OBJECT
  12. public:
  13. EquirectangularToFovBase(Arff* pArff);
  14. virtual ~EquirectangularToFovBase() = 0;
  15. protected:
  16. void EquirectangularToSpherical(unsigned int xEq, unsigned int yEq, unsigned int widthPx, unsigned int heightPx, double *horRads, double *verRads);
  17. ///< Converts the provided equirectangular coordinates to angles i.e. spherical representation.
  18. void SphericalToEquirectangular(double horRads, double verRads, unsigned int widthPx, unsigned int heightPx, unsigned int *xEq, unsigned int *yEq);
  19. ///< Converts spherical coordinates to pixels in the equirectangular representation.
  20. void SphericalToCartesian(double horRads, double verRads, Vec3 *cart);
  21. ///< Converts a unit vector from spherical to cartesian coordinates.
  22. ///< \p horRads is the angle in the between X axis and the vector in the XZ plane
  23. ///< \p verRads is teh angle between the vector and the Y axis.
  24. void CartesianToSpherical(Vec3 cart, double *horRads, double *verRads);
  25. ///< Converts a cartesian vector to unit spherical vector.
  26. void GetHeadPos(long int time, double *x, double *y, double *tilt);
  27. ///< Retrieve the head position.
  28. void GetHeadPos(unsigned int ind, double *x, double *y, double *tilt);
  29. void GetEyePos(unsigned int ind, double *x, double *y);
  30. Matrix33 HeadToVideoRotation(Vec3 head, double headTiltRads, Vec3 video);
  31. Matrix33 YZXrotation(Vec3 vec, double tiltRads);
  32. Arff *m_pArff;
  33. int m_horHeadInd;
  34. int m_verHeadInd;
  35. int m_tiltHeadInd;
  36. int m_timeInd;
  37. int m_xInd;
  38. int m_yInd;
  39. int m_confInd;
  40. int m_fovWidthPx;
  41. int m_fovHeightPx;
  42. double m_fovWidthDeg;
  43. double m_fovHeightDeg;
  44. vector<double> m_vHorSampling;
  45. vector<double> m_vVerSampling;
  46. };
  47. #endif /*__EQUIRECTANGULARTOFOV_H__*/