Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef IMAGEWIDGET_H_
  2. #define IMAGEWIDGET_H_
  3.  
  4. #include <opencv2/opencv.hpp>
  5. #include <GL/gl.h>
  6. #include <GL/glext.h>
  7. #include <GL/glu.h>
  8. #include <QObject>
  9. #include <QtOpenGL>
  10.  
  11. #include "../../Utils/Image.h"
  12. #include "../../Utils/Log.h"
  13.  
  14. class ImageWidget : public QGLWidget {
  15.  
  16. Q_OBJECT
  17.  
  18. public:
  19.  
  20.     /*!
  21.      * ImageWidget constructor.
  22.      *
  23.      * @param parent The parent widget.
  24.      * @param width Image width.
  25.      * @param height Image height.
  26.      */
  27.     ImageWidget(QWidget* parent = 0, int width = 320, int height = 240);
  28.  
  29.     /*!
  30.      * Refreshes the image.
  31.      *
  32.      * @param image The image to be refreshed.
  33.      */
  34.     virtual void refreshImage(IplImage* image);
  35.  
  36.     /*!
  37.      * Returns current image
  38.      */
  39.     IplImage* getImage() {
  40.         return _imageRef;
  41.     }
  42.  
  43. protected:
  44.  
  45.     //Initialized with NULL on constructor's initialization list.
  46.     //! Image reference.
  47.     IplImage *_imageRef;
  48.  
  49.     /*!
  50.      * Resizes the viewport.
  51.      *
  52.      * @param width Viewport width.
  53.      * @param height Viewport height.
  54.      */
  55.     void resizeGL(int width, int height);
  56.  
  57.     /*!
  58.      * Image widget paint event handler.
  59.      *
  60.      * @param paintEvent The event to be handled.
  61.      */
  62.     virtual void paintEvent(QPaintEvent *paintEvent);
  63.  
  64.     /*!
  65.      * Sets the viewport up.
  66.      *
  67.      * @param width Viewport width.
  68.      * @param height Viewport height.
  69.      */
  70.     void setupViewPort(int width, int height);
  71.  
  72.     /*!
  73.      * Draws the background image.
  74.      */
  75.     void drawBackgroundImage();
  76. };
  77.  
  78. #endif /* IMAGEWIDGET_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement