108 lines
2.2 KiB
C++
108 lines
2.2 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include "posdevice.h"
|
|
#include "camera.h"
|
|
#include "QImage"
|
|
#include "QPixmap"
|
|
#include <opencv2/opencv.hpp>
|
|
#include "rotationstage.h"
|
|
#include "QTimer"
|
|
#include "imageview.h"
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui {
|
|
class MainWindow;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
cv::Rect trackRoiWithCorrelation(const cv::Mat& frame);
|
|
void updateTemplate(const cv::Mat& frame, const cv::Rect& roi);
|
|
QImage cvMatToQImage(const cv::Mat& mat);
|
|
cv::Point2f calculateCentroid(const cv::Mat& image, const cv::Rect& roi);
|
|
void closeloop();
|
|
|
|
|
|
|
|
private slots:
|
|
void on_pushButton_clicked();
|
|
void revPosData(QVector<QString>);
|
|
void revPicData(QImage);
|
|
void revRotateData(QVector<double>);
|
|
|
|
void on_pushButton_3_clicked();
|
|
|
|
void on_pushButton_5_clicked();
|
|
|
|
void on_pushButton_4_clicked();
|
|
|
|
void on_pushButton_10_clicked();
|
|
|
|
void on_pushButton_6_pressed();
|
|
|
|
void on_pushButton_6_released();
|
|
void zmove();
|
|
void zmove_();
|
|
void umove();
|
|
void umove_();
|
|
|
|
|
|
|
|
void on_pushButton_7_pressed();
|
|
|
|
void on_pushButton_7_released();
|
|
|
|
void on_pushButton_8_pressed();
|
|
|
|
void on_pushButton_8_released();
|
|
|
|
void on_pushButton_9_pressed();
|
|
|
|
void on_pushButton_9_released();
|
|
|
|
void on_pushButton_11_clicked();
|
|
|
|
void onRoiSelected(const QRectF &roi);
|
|
|
|
void on_pushButton_2_clicked();
|
|
|
|
void on_pushButton_12_clicked();
|
|
|
|
|
|
void on_pushButton_13_clicked();
|
|
|
|
void on_pushButton_14_clicked();
|
|
|
|
private:
|
|
Ui::MainWindow *ui;
|
|
PosDevice *pos;
|
|
Camera *cam;
|
|
QGraphicsScene *scene;
|
|
RotationStage *rs;
|
|
QTimer *tz,*tz_,*tu,*tu_;
|
|
QGraphicsPixmapItem *pximg;
|
|
int topLeft,topRight,selectWidth,selectHeight;
|
|
bool isFirstFrame;
|
|
|
|
cv::Mat roiTemplate; // ROI模板
|
|
cv::Rect lastRoi; // 上一帧的ROI位置
|
|
|
|
cv::Point2f centroidInit; // 初始位置
|
|
cv::Point2f centroid; //当前位置
|
|
|
|
bool loopState;
|
|
std::thread *task;
|
|
|
|
|
|
|
|
};
|
|
#endif // MAINWINDOW_H
|