EquirectangularToFovVideo.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // EquirectangularToFovVideo.h
  2. // equirectangular to field of view conversion for videos/images
  3. #ifndef __EQUIRECTANGULARTOFOVVIDEO_H__
  4. #define __EQUIRECTANGULARTOFOVVIDEO_H__
  5. #include "EquirectangularToFovBase.h"
  6. #include <QImage>
  7. using namespace std;
  8. #ifdef USE_CUDA
  9. struct ConvertionInfo
  10. {
  11. double fovWidth_deg;
  12. double fovHeight_deg;
  13. int fovWidth_px;
  14. int fovHeight_px;
  15. int eqWidth_px;
  16. int eqHeight_px;
  17. Matrix33 rot;
  18. Vec3 tmpVec;
  19. ConvertionInfo(): tmpVec{Vec3(0,0,0)} {}
  20. };
  21. #endif
  22. class EquirectangularToFovVideo : public EquirectangularToFovBase
  23. {
  24. public:
  25. EquirectangularToFovVideo(Arff* pArff);
  26. virtual ~EquirectangularToFovVideo();
  27. bool Convert(const QImage *eqImage, long int time, QImage *fovImage);
  28. double GetAspectRatio();
  29. ///< Return the aspect ratio of the FOV. Aspect ratio = width_fov/height_fov
  30. private:
  31. void GenerateSampling(const QImage *image);
  32. ///< This function generates the sampling on the sphere for the given image size
  33. void Generate1DSampling(double fovRads, vector<double> *samples);
  34. ///< For the fiven field of view (rads) populates the provided vector with
  35. ///< the correct sampling angles. The samples are placed of the periphery
  36. ///< of the circle. This means that every sample represents the same angle
  37. vector<double> m_vHorSampling;
  38. vector<double> m_vVerSampling;
  39. #ifdef USE_CUDA
  40. uchar *eq_d;
  41. uchar *fov_d;
  42. ConvertionInfo *m_pInfo;
  43. #endif
  44. };
  45. #endif /*__EQUIRECTANGULARTOFOVVIDEO_H__*/