EpipolarGeometryDisplay.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // C++ Interface: EpipolarGeometryVisualizer
  3. //
  4. // Description:
  5. //
  6. //
  7. // Author: Marcel Brueckner <brueckner [at] informatik [dot] uni-jena [dot] de>, (C) 2008
  8. //
  9. // Copyright: See COPYING file that comes with this distribution
  10. //
  11. //
  12. #ifndef _IMAGEDISPLAY_EPIPOLARGEOMETRYVISUALIZER_H
  13. #define _IMAGEDISPLAY_EPIPOLARGEOMETRYVISUALIZER_H
  14. #include <core/imagedisplay/ImageDisplay.h>
  15. #include <core/vector/MatrixT.h>
  16. #include <core/image/CoordT.h>
  17. #include <vector>
  18. namespace NICE {
  19. class EpipolarGeometryDisplay : public ImageDisplay {
  20. Q_OBJECT;
  21. public:
  22. EpipolarGeometryDisplay (std::vector< CoordT<double> >* points,
  23. std::vector< std::pair<CoordT<double>, CoordT<double> > >* epipolarLines,
  24. QWidget* parent = NULL, const char* name = NULL,
  25. Qt::WFlags flags = 0);
  26. inline void addPoint (const Vector& point) {
  27. double x = point[0]/point[2];
  28. double y = point[1]/point[2];
  29. if (x > 0.0 && y > 0.0 && x < imageWidth() && y < imageHeight()) {
  30. m_points->push_back(CoordT<double>(x/imageWidth(), 1.0f - y/imageHeight()));
  31. }
  32. }
  33. void addEpipolarLine (const Vector& epipolarLine);
  34. inline void clearPoints(void) {
  35. m_points->clear();
  36. }
  37. inline void clearEpipolarLines(void) {
  38. m_epipolarLines->clear();
  39. }
  40. protected:
  41. //! receive mouse events
  42. virtual void mousePressEvent(QMouseEvent* event);
  43. virtual void setGLProjection(void);
  44. virtual void paintGLObjects(void);
  45. private:
  46. virtual void contextMenuEvent(QContextMenuEvent* event);
  47. std::vector< CoordT<double> >* m_points;
  48. std::vector< std::pair<CoordT<double>, CoordT<double> > >* m_epipolarLines;
  49. };
  50. }
  51. #endif