-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcqtopencvviewergl.h
56 lines (39 loc) · 1.73 KB
/
cqtopencvviewergl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*=========================================================================
Program: OpenCVDisparityTuner
Copyright (c) Julien Jomier
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef CQTOPENCVVIEWERGL_H
#define CQTOPENCVVIEWERGL_H
#include <QOpenGLWidget>
#include <opencv2/core/core.hpp>
class CQtOpenCVViewerGl : public QOpenGLWidget
{
Q_OBJECT
public:
explicit CQtOpenCVViewerGl(QWidget *parent = 0);
signals:
void imageSizeChanged( int outW, int outH ); /// Used to resize the image outside the widget
public slots:
bool showImage(cv::Mat image); /// Used to set the image to be viewed
protected:
void initializeGL(); /// OpenGL initialization
void paintGL(); /// OpenGL Rendering
void resizeGL(int width, int height); /// Widget Resize Event
void updateScene();
void renderImage();
private:
bool mSceneChanged; /// Indicates when OpenGL view is to be redrawn
QImage mRenderQtImg; /// Qt image to be rendered
cv::Mat mOrigImage; /// original OpenCV image to be shown
QColor mBgColor; /// Background color
int mOutH; /// Resized Image height
int mOutW; /// Resized Image width
float mImgRatio; /// height/width ratio
int mPosX; /// Top left X position to render image in the center of widget
int mPosY; /// Top left Y position to render image in the center of widget
};
#endif // CQTOPENCVVIEWERGL_H