43 lines
949 B
C
43 lines
949 B
C
|
#pragma once
|
|||
|
|
|||
|
#include <QWidget>
|
|||
|
#include <QObject>
|
|||
|
#include <QDebug>
|
|||
|
#include <QEvent>
|
|||
|
#include <QWheelEvent>
|
|||
|
|
|||
|
#include <QGraphicsView>
|
|||
|
#include <QGraphicsScene>
|
|||
|
//#include <QGraphicsItem>
|
|||
|
//#include <QPainter>
|
|||
|
|
|||
|
#include <opencv2/opencv.hpp>
|
|||
|
|
|||
|
class CvGraphicsViewWidget :public QGraphicsView
|
|||
|
{
|
|||
|
Q_OBJECT
|
|||
|
|
|||
|
public:
|
|||
|
CvGraphicsViewWidget(QWidget* parent = Q_NULLPTR);
|
|||
|
virtual ~CvGraphicsViewWidget() {}
|
|||
|
|
|||
|
public:
|
|||
|
void showImage(cv::Mat const& _himg);
|
|||
|
|
|||
|
static void CvImage2QPixmap(cv::Mat const& fromCv, QPixmap& toPix);
|
|||
|
static bool QImage2CvImage(QImage& fromQ, cv::Mat& toCv);
|
|||
|
//static void QPixmapToCvRegion(QPixmap const& _pix, cv::Rect2d& tarImg);
|
|||
|
|
|||
|
protected:
|
|||
|
//void paintEvent(QPaintEvent* event) override;
|
|||
|
//void wheelEvent(QWheelEvent* ev);
|
|||
|
|
|||
|
private:
|
|||
|
QGraphicsScene* mGraphicsScene;
|
|||
|
//QGraphicsRectItem* item;
|
|||
|
|
|||
|
//QColor penColor = QColor(0, 180, 255);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|||
|
//int penWidth = 2;//<2F><><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD>
|
|||
|
qreal mScaledFactor; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
|
|||
|
|
|||
|
};
|