OpenCVWidget
opencvviewer.h
Go to the documentation of this file.
00001 #ifndef OPENCVVIEWER_H
00002 #define OPENCVVIEWER_H
00003 
00004 #include <QtGui>
00005 #include <QGLWidget>
00006 #include <QtOpenGL>
00007 #include <opencv2/highgui/highgui.hpp>
00008 #include <opencv2/core/core.hpp>
00009 #include <math.h>
00010 
00011 // On Windows, GL_BGR is not defined by default. Fix that:
00012 #ifndef GL_BGR
00013 #define GL_BGR 0x80E0
00014 #endif
00015 
00016 class QGLShaderProgram;
00017 
00027 class OpenCVViewer : public QGLWidget
00028 {
00029     Q_OBJECT
00030 
00031 public:
00038     OpenCVViewer(QWidget *parent = 0, QGLWidget *shareWidget = 0);
00039     ~OpenCVViewer();
00040 
00046     QSize sizeHint() const;
00047 
00048 
00058     cv::Mat getImage();
00059 
00067     void setImage(cv::Mat newImage);
00068 
00069 
00076     cv::Point mapPoint(cv::Point widgetCoords);
00077 
00078 
00079 
00080 protected:
00081     void initializeGL(); 
00082     void paintGL(); 
00083     void resizeGL(int width, int height); 
00084     void mousePressEvent(QMouseEvent *event); 
00085     void mouseMoveEvent(QMouseEvent* event); 
00086 
00087     GLuint texture; 
00088     QVector<QVector2D> vertices; 
00089     QVector<QVector2D> texCoords; 
00090     cv::Mat displayImage; 
00091 
00092 
00093 signals:
00094     void mouseClicked(QMouseEvent* event); 
00095     void mouseMoved(QMouseEvent* event); 
00096 
00097 };
00098 
00099 #endif // OPENCVVIEWER_H
 All Classes Files Functions Variables