diff --git a/QT Source/RUBO.rc b/QT Source/RUBO.rc deleted file mode 100644 index 6ea288b..0000000 --- a/QT Source/RUBO.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "RUBO1-tou.png" \ No newline at end of file diff --git a/QT Source/RUBO1-small.png b/QT Source/RUBO1-small.png deleted file mode 100644 index 39102b2..0000000 Binary files a/QT Source/RUBO1-small.png and /dev/null differ diff --git a/QT Source/RUBO1-tou.ico b/QT Source/RUBO1-tou.ico deleted file mode 100644 index 44ef937..0000000 Binary files a/QT Source/RUBO1-tou.ico and /dev/null differ diff --git a/QT Source/RUBO1-tou.png b/QT Source/RUBO1-tou.png deleted file mode 100644 index 898969f..0000000 Binary files a/QT Source/RUBO1-tou.png and /dev/null differ diff --git a/QT Source/RUBO1.png b/QT Source/RUBO1.png deleted file mode 100644 index 39102b2..0000000 Binary files a/QT Source/RUBO1.png and /dev/null differ diff --git a/QT Source/RUBO2.png b/QT Source/RUBO2.png deleted file mode 100644 index a83dcb2..0000000 Binary files a/QT Source/RUBO2.png and /dev/null differ diff --git a/QT Source/change-view.cpp b/QT Source/change-view.cpp deleted file mode 100644 index 6ce4067..0000000 --- a/QT Source/change-view.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" -#include "change-view.h" -using namespace std; -using namespace cv; -#define num_type unsigned char -int width; -int high; -int width_end; -int high_end; -float point[4][2]; -int point_center_y;//0~high_end -int see_len; -bool flag = false; -Mat src; -int test_flag = 1; //0进行透视变换 1获取矩阵 -int val1; -int cnt = 0; -int x31, - x41, - x11, y11 -, x21, y21, - x12, y12, - x22, y22; -int point_center_x; -QString Mat2QString(const Mat &src1) { - if (src1.empty()) return QString(); - stringstream stream; - stream << src1; - return QString::fromStdString(stream.str()); -} -void read_pic(string path) { - src = imread(path); - width = src.cols; - high = src.rows; - cvtColor(src, src, COLOR_RGB2GRAY, 0); -} -void init_para() { - pic.PIC_OPEN = 1; - pic.click_cnt = 0; - pic.change = 0; -} -void change_view() { - point_center_x = width_end / 2; - vector src_coners(4); - int y31, y41; - x31 = point[0][0], - x41 = point[1][0], - x11 = point[2][0], y11 = point[2][1], y21 = point[3][1]; - x21 = point[3][0], y31 = point[0][1], y41 = point[1][1]; - x12 = point_center_x - see_len / 2, y12 = point_center_y - see_len / 2, - x22 = point_center_x + see_len / 2, y22 = point_center_y + see_len / 2; - /* - * (x11,y11)******************(x21,y11) (x12,y12)**************(x22,y12) - * * * * * - * * 原图(梯形) * --------> * 结果(正方形)* - * * * * * - * (x31,y21)******************************(x41,y21) (x12,y22)**************(x22,y22) - * test_flag=1时:(坐标手点,从X31开始,逆时针点四次) (坐标自己在代码上修改) ----> 将打印出的矩阵放入代码 - * test_flag=0时: 右键图片查看效果 - * - * - */ - - src_coners[0] = Point2f(x31, y31); - src_coners[1] = Point2f(x41, y41); - src_coners[2] = Point2f(x11, y11); - src_coners[3] = Point2f(x21, y21); - vector dst_coners(4); - dst_coners[0] = Point2f(x12, y22); - dst_coners[1] = Point2f(x22, y22); - dst_coners[2] = Point2f(x12, y12); - dst_coners[3] = Point2f(x22, y12); - Mat warpMatrix; - warpMatrix = getPerspectiveTransform(src_coners, dst_coners); - double change_Mat[3][3]; - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - change_Mat[i][j] = warpMatrix.at(i, j); - num_type src_tmp1[high][width]; - double change_un_Mat[3][3]; - for (int i = 0; i < high; i++) - for (int j = 0; j < width; j++) - src_tmp1[i][j] = src.at(i, j); - Mat un_warpMatrix; //逆矩阵 - - invert(warpMatrix, un_warpMatrix, DECOMP_LU); - cout << "逆矩阵" << endl << un_warpMatrix << endl; - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(Mat2QString(un_warpMatrix)); - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - change_un_Mat[i][j] = un_warpMatrix.at(i, j); - unsigned char *b[high_end][width_end]; - /******************指针地址映射*******************/ - unsigned char back_color = 255; - for (int i = 0; i < width_end; i++) { - for (int j = 0; j < high_end; j++) { - int local_x = (int) ((change_un_Mat[0][0] * i + change_un_Mat[0][1] * j + change_un_Mat[0][2]) / - (change_un_Mat[2][0] * i + change_un_Mat[2][1] * j + change_un_Mat[2][2])); - int local_y = (int) ((change_un_Mat[1][0] * i + change_un_Mat[1][1] * j + change_un_Mat[1][2]) / - (change_un_Mat[2][0] * i + change_un_Mat[2][1] * j + change_un_Mat[2][2])); - if (local_x >= 0 && local_y >= 0 && local_y < high && local_x < width) { - b[j][i] = &src_tmp1[local_y][local_x]; - } else b[j][i] = &back_color; - } - } - - /**********数组获取指针值&显示图片***********************/ - Mat src1; - src1 = (Mat::ones(high_end, width_end, CV_8U)); - unsigned char bb[high_end][width_end];//图 - memset(bb, 0, sizeof(bb)); - for (int i = 1; i < high_end - 1; i++) - for (int j = 1; j < width_end - 1; j++) - bb[i][j] = *b[i][j]; - for (int i = 0; i < high_end; i++) - for (int j = 0; j < width_end; j++) - src1.at(i, j) = bb[i][j]; - namedWindow("result", 0); - int n1 = screenX / 5 * 3 / width_end; - int n2 = screenY / 5 * 3 / high_end; - resizeWindow("result", width_end * min(n1, n2), high_end * min(n1, n2)); - imshow("result", src1); -} diff --git a/QT Source/change-view.h b/QT Source/change-view.h deleted file mode 100644 index 51f879e..0000000 --- a/QT Source/change-view.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef CHANGEVIEW_H -#define CHANGEVIEW_H -#include "opencv2/opencv.hpp" - -using namespace std; -using namespace cv; - -extern Mat src; - -void read_pic(string path); -void init_para(); -void change_view(); -extern int width ; -extern int high ; -extern int width_end ; -extern int high_end ; -extern float point[4][2]; -extern int point_center_y ;//0~high_end -extern int see_len ; -#endif // CHANGEVIEW_H diff --git a/QT Source/change-view.pro b/QT Source/change-view.pro deleted file mode 100644 index 3efe58b..0000000 --- a/QT Source/change-view.pro +++ /dev/null @@ -1,93 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2022-07-26T15:03:02 -# -#------------------------------------------------- - -QT += core gui - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = change-view -TEMPLATE = app - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -CONFIG += c++11 - -SOURCES += \ - main.cpp \ - mainwindow.cpp \ - change-view.cpp \ - rubo_label.cpp - -HEADERS += \ - mainwindow.h \ - change-view.h \ - rubo_label.h - -FORMS += \ - mainwindow.ui - -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target - - -INCLUDEPATH += C:\OPENCV\make-qt\install\include -C:\OPENCV\opencv\opencv\build\include\opencv2 -C:\OPENCV\opencv\opencv\build\bin -LIBS += C:\OPENCV\make-qt\install\x64\mingw\bin\libopencv_*.dll --lopencv_world401 --lopencv_world401d -LIBS += -lpthread libwsock32 libws2_32 - -#CONFIG += console - - - -#可执行文件名称 -TARGET="RUBO IPM" - - -#版本信息 -VERSION = 1.0.0 - -#图标 - -#公司名称 -QMAKE_TARGET_COMPANY = "RUBO" - -#产品名称 -QMAKE_TARGET_PRODUCT = "RUBO IPM" - -#文件说明 -QMAKE_TARGET_DESCRIPTION = "MADE BY RUBO" - -#版权信息 -QMAKE_TARGET_COPYRIGHT = "RUBO" - -#中文(简体) -RC_LANG = 0x0004 - -RESOURCES += \ - rubo.qrc - - - - -RC_ICONS = RUBO1-tou.ico - - - - diff --git a/QT Source/change-view.pro.user b/QT Source/change-view.pro.user deleted file mode 100644 index ca0165a..0000000 --- a/QT Source/change-view.pro.user +++ /dev/null @@ -1,577 +0,0 @@ - - - - - - EnvironmentId - {75065ab1-f329-4ded-97fe-89865eac0c8e} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.12.0 MinGW 64-bit - Desktop Qt 5.12.0 MinGW 64-bit - qt.qt5.5120.win64_mingw73_kit - 1 - 0 - 0 - - C:/Users/Administrator/Documents/build-change-view-Desktop_Qt_5_12_0_MinGW_64_bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - C:/Users/Administrator/Documents/build-change-view-Desktop_Qt_5_12_0_MinGW_64_bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - C:/Users/Administrator/Documents/build-change-view-Desktop_Qt_5_12_0_MinGW_64_bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - 部署 - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy Configuration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - change-view - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Administrator/Documents/change-view/change-view.pro - change-view.pro - - 3768 - false - true - true - false - false - true - false - - C:/Users/Administrator/Documents/build-change-view-Desktop_Qt_5_12_0_MinGW_64_bit-Release - - 1 - - - - ProjectExplorer.Project.Target.1 - - 未命名 - 未命名 - {579e4723-bbb2-4c26-b129-5b8b0f1ef97e} - 0 - 0 - 0 - - C:/Users/Administrator/Documents/build-change-view-unknown-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - C:/Users/Administrator/Documents/build-change-view-unknown-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - C:/Users/Administrator/Documents/build-change-view-unknown-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - 部署 - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy Configuration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - change-view - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Administrator/Documents/change-view/change-view.pro - change-view.pro - - 3768 - false - true - true - false - false - true - false - - - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 20 - - - Version - 20 - - diff --git a/QT Source/main.cpp b/QT Source/main.cpp deleted file mode 100644 index d89c41a..0000000 --- a/QT Source/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "mainwindow.h" -#include - -int main(int argc, char *argv[]) -{ - - QApplication a(argc, argv); - - MainWindow w; - w.show(); - - return a.exec(); -} diff --git a/QT Source/mainwindow.cpp b/QT Source/mainwindow.cpp deleted file mode 100644 index fec6fc0..0000000 --- a/QT Source/mainwindow.cpp +++ /dev/null @@ -1,276 +0,0 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" -#include "rubo_label.h" -using namespace std; -using namespace cv; -int screenX, screenY; -pic_show pic; -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) { - this->setWindowIcon(QIcon(":RUBO1-tou.png")); - ui->setupUi(this); - mouse_init(); - /*************定时器*********************/ - id1 = startTimer(1000); - QTimer *timer = new QTimer(this); /* 创建一个新的定时器 */ - connect(timer, SIGNAL(timeout()), this, SLOT(timerUpdate())); - timer->start(1); /* 设置溢出时间为1秒,并启动定时器 */ - qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime())); - open_mainwindows_updata_windows(); -} -bool MainWindow::judge_int(QString a) { - if (!a.contains(QRegExp("^\\d+$"))) { - QMessageBox::critical(this, "错误", "参数输入错误!"); - return 0; - } - return 1; -} -MainWindow::~MainWindow() { - delete ui; -} -void MainWindow::open_pic_update_windows() { - init_windows(pic.show_width, pic.show_high); - ui->label_tips->setText("用鼠标右键点击,从方形左下-右下-左上-右上选取四个点:"); - ui->label_pic1->setGeometry(ui->label_pic1->x(), ui->label_pic1->y(), pic.show_width, pic.show_high); -} -void MainWindow::open_mainwindows_updata_windows() { - QDesktopWidget *desktopWidget = QApplication::desktop(); - //获取设备屏幕大小 - QRect screenRect = desktopWidget->screenGeometry(); - screenX = screenRect.width(); - screenY = screenRect.height(); - int init_width = 114, init_high = 100; - int n1 = screenX / 5 * 3 / init_width; - int n2 = screenY / 5 * 3 / init_high; - pic.zoom = min(n1, n2); - pic.show_width = pic.zoom * init_width; - pic.show_high = pic.zoom * init_high; - init_windows(pic.show_width, pic.show_high); //1200--940 600-600 - ui->button_change->setEnabled(0); - ui->label_tips->setText("请打开图片"); - pic.PIC_OPEN = 0; - pic.change = 0; -} -void MainWindow::QString_to_string(QString a, string *b) { - *b = a.toStdString(); -} -void MainWindow::init_model1_windows(int start_x, int start_y) { - ui->label_width->setGeometry(start_x, start_y, ui->label_width->width(), ui->label_width->height()); - ui->label_high->setGeometry(start_x, start_y + 50, ui->label_high->width(), ui->label_high->height()); - ui->label_ysite->setGeometry(start_x - 50, start_y + 50 * 2, ui->label_ysite->width(), ui->label_ysite->height()); - ui->label_len->setGeometry(start_x, start_y + 50 * 3, ui->label_len->width(), ui->label_len->height()); - ui->text_width->setGeometry(start_x + 100, start_y - 10, ui->text_width->width(), ui->text_width->height()); - ui->text_high->setGeometry(start_x + 100, start_y + 50 - 10, ui->text_high->width(), ui->text_high->height()); - ui->text_ysite->setGeometry(start_x + 100, start_y + 50 * 2 - 10, ui->text_ysite->width(), - ui->text_ysite->height()); - ui->text_len->setGeometry(start_x + 100, start_y + 50 * 3 - 10, ui->text_len->width(), ui->text_len->height()); -} -void MainWindow::init_model2_windows(int start_x, int start_y) { - ui->label_x1->setGeometry(start_x, start_y, ui->label_x1->width(), ui->label_x1->height()); - ui->label_x2->setGeometry(start_x, start_y + 50, ui->label_x2->width(), ui->label_x2->height()); - ui->label_x3->setGeometry(start_x, start_y + 50 * 2, ui->label_x3->width(), ui->label_x3->height()); - ui->label_x4->setGeometry(start_x, start_y + 50 * 3, ui->label_x4->width(), ui->label_x4->height()); - ui->label_y1->setGeometry(start_x + 100, start_y, ui->label_y1->width(), ui->label_y1->height()); - ui->label_y2->setGeometry(start_x + 100, start_y + 50, ui->label_y2->width(), ui->label_y2->height()); - ui->label_y3->setGeometry(start_x + 100, start_y + 50 * 2, ui->label_y3->width(), ui->label_y3->height()); - ui->label_y4->setGeometry(start_x + 100, start_y + 50 * 3, ui->label_y4->width(), ui->label_y4->height()); - ui->text_x1->setGeometry(start_x + 30, start_y - 10, ui->text_x1->width(), ui->text_x1->height()); - ui->text_x2->setGeometry(start_x + 30, start_y + 50 - 10, ui->text_x2->width(), ui->text_x2->height()); - ui->text_x3->setGeometry(start_x + 30, start_y + 50 * 2 - 10, ui->text_x3->width(), ui->text_x3->height()); - ui->text_x4->setGeometry(start_x + 30, start_y + 50 * 3 - 10, ui->text_x4->width(), ui->text_x4->height()); - ui->text_y1->setGeometry(start_x + 100 + 30, start_y - 10, ui->text_y1->width(), ui->text_y1->height()); - ui->text_y2->setGeometry(start_x + 100 + 30, start_y + 50 - 10, ui->text_y2->width(), ui->text_y2->height()); - ui->text_y3->setGeometry(start_x + 100 + 30, start_y + 50 * 2 - 10, ui->text_y3->width(), ui->text_y3->height()); - ui->text_y4->setGeometry(start_x + 100 + 30, start_y + 50 * 3 - 10, ui->text_y4->width(), ui->text_y4->height()); -} -void MainWindow::init_model3_windows(int start_x, int start_y) { - ui->button_clear->setGeometry(start_x + 60, start_y, ui->button_clear->width(), ui->button_clear->height()); - ui->button_openpic->setGeometry(start_x + 60, start_y + 40, ui->button_openpic->width(), - ui->button_openpic->height()); - ui->button_change->setGeometry(start_x + 60, start_y + 80, ui->button_change->width(), ui->button_change->height()); -} -void MainWindow::init_model4_windows(int start_x, int start_y) { - ui->label_pic1->setGeometry(start_x, start_y, ui->label_pic1->width(), ui->label_pic1->height()); -} -void MainWindow::init_model5_windows(int start_x, int start_y) { - ui->label_tips->setGeometry(start_x, start_y, ui->label_tips->width(), ui->label_tips->height()); -} -void MainWindow::init_windows(int start_width, int start_high) { - /****************main_window*******************/ - setFixedSize(this->width(), this->height()); - /****************modle1***************/ - int model1_start_x = start_width + 60, model1_start_y = 30; - init_model1_windows(model1_start_x, model1_start_y); - int model2_start_x = start_width + 60, model2_start_y = 230; - init_model2_windows(model2_start_x, model2_start_y); - int model3_start_x = start_width + 60 - 10, model3_start_y = 420; - init_model3_windows(model3_start_x, model3_start_y); - int model4_start_x = 0, model4_start_y = 0; - init_model4_windows(model4_start_x, model4_start_y); - setFixedSize(start_width + 260, max(start_high + 50, 550)); - int model5_start_x = 0, model5_start_y = start_high + 5; - init_model5_windows(model5_start_x, model5_start_y); -} -void MainWindow::update_windows() { -} -void MainWindow::active_windows() { - Qt::WindowStates winStatus = Qt::WindowNoState; - if (windowState() & Qt::WindowMaximized) { - winStatus = Qt::WindowMaximized; - } - setWindowState(Qt::WindowMinimized); - setWindowState(Qt::WindowActive | winStatus); - setGeometry(geometry()); - activateWindow(); - raise(); -} -void MainWindow::on_button_openpic_clicked() { - QString filename = QFileDialog::getOpenFileName(this, tr("选择图像"), "", tr("Images (*.png *.bmp *.jpg)")); - if (filename.isEmpty()) return; - QImage img; - if (!(img.load(filename))) //加载图像 - { - QMessageBox::information(this, tr("打开图像失败"), tr("打开图像失败!")); - return; - } - string path; - QString_to_string(filename, &path); - read_pic(path); - update_windows(); - int n1 = screenX / 5 * 3 / img.width(); - int n2 = screenY / 5 * 3 / img.height(); - pic.width = img.width(); - pic.high = img.height(); - pic.zoom = min(n1, n2); - pic.show_width = pic.zoom * pic.width; - pic.show_high = pic.zoom * pic.high; - open_pic_update_windows(); - init_para(); - on_button_clear_clicked(); - ui->label_pic1->setPixmap(QPixmap::fromImage(img.scaled(ui->label_pic1->size()))); - ui->button_change->setEnabled(1); - active_windows(); -} -void MainWindow::on_button_clear_clicked() { - ui->text_x1->clear(); - ui->text_y1->clear(); - ui->text_x2->clear(); - ui->text_y2->clear(); - ui->text_x3->clear(); - ui->text_y3->clear(); - ui->text_x4->clear(); - ui->text_y4->clear(); - pic.click_cnt = 0; - pic.change = 0; -} -void MainWindow::timerUpdate() { /* 定时器溢出处理 */ - if (!pic.PIC_OPEN)return; - if (pic.change) { - QString str = "透视变换成功,已复制至剪切板"; - ui->label_tips->setText(str); - return; - } - if (mouse_flag.enter) { - if (mouse_flag.click == 2) { - if (pic.click_cnt == 1) { - QString str = "选中第一个点x:" + QString::number(mouse_flag.x, 10) + " " + "y:" + - QString::number(mouse_flag.y, 10); - ui->label_tips->setText(str); - ui->text_x1->append(QString::number(mouse_flag.x, 10)); - ui->text_y1->append(QString::number(mouse_flag.y, 10)); - } - if (pic.click_cnt == 2) { - QString str = "选中第二个点x:" + QString::number(mouse_flag.x, 10) + " " + "y:" + - QString::number(mouse_flag.y, 10); - ui->label_tips->setText(str); - ui->text_x2->append(QString::number(mouse_flag.x, 10)); - ui->text_y2->append(QString::number(mouse_flag.y, 10)); - } - if (pic.click_cnt == 3) { - QString str = "选中第三个点x:" + QString::number(mouse_flag.x, 10) + " " + "y:" + - QString::number(mouse_flag.y, 10); - ui->label_tips->setText(str); - ui->text_x3->append(QString::number(mouse_flag.x, 10)); - ui->text_y3->append(QString::number(mouse_flag.y, 10)); - } - if (pic.click_cnt == 4) { - QString str = "选中第四个点x:" + QString::number(mouse_flag.x, 10) + " " + "y:" + - QString::number(mouse_flag.y, 10); - ui->label_tips->setText(str); - ui->text_x4->append(QString::number(mouse_flag.x, 10)); - ui->text_y4->append(QString::number(mouse_flag.y, 10)); - } - mouse_flag.click = 0; - mouse_flag.move = 0; - return; - } - if (mouse_flag.move && pic.change == 0) { - mouse_flag.move = 0; - QString str = "x:" + QString::number(mouse_flag.x, 10) + " " + "y:" + QString::number(mouse_flag.y, 10); - ui->label_tips->setText(str); - } - } else { - ui->label_tips->setText("用鼠标右键点击,从方形左下-右下-左上-右上选取四个点"); - } -} -void MainWindow::on_button_change_clicked() { - QString num_tmp; - /**********************结果图基本信息***********************/ - num_tmp = ui->text_width->toPlainText(); - if (!judge_int(num_tmp))return; - width_end = num_tmp.toInt(); - num_tmp = ui->text_high->toPlainText(); - if (!judge_int(num_tmp))return; - high_end = num_tmp.toInt(); - num_tmp = ui->text_ysite->toPlainText(); - if (!judge_int(num_tmp))return; - point_center_y = num_tmp.toInt(); - num_tmp = ui->text_len->toPlainText(); - if (!judge_int(num_tmp))return; - see_len = num_tmp.toInt(); - - /***********************透视坐标***************************/ - num_tmp = ui->text_x1->toPlainText(); - if (!judge_int(num_tmp))return; - point[0][0] = (float) (num_tmp.toFloat()); - num_tmp = ui->text_y1->toPlainText(); - if (!judge_int(num_tmp))return; - point[0][1] = (float) (num_tmp.toFloat()); - num_tmp = ui->text_x2->toPlainText(); - if (!judge_int(num_tmp))return; - point[1][0] = (float) (num_tmp.toFloat()); - num_tmp = ui->text_y2->toPlainText(); - if (!judge_int(num_tmp))return; - point[1][1] = (float) (num_tmp.toFloat()); - num_tmp = ui->text_x3->toPlainText(); - if (!judge_int(num_tmp))return; - point[2][0] = (float) (num_tmp.toFloat()); - num_tmp = ui->text_y3->toPlainText(); - if (!judge_int(num_tmp))return; - point[2][1] = (float) (num_tmp.toFloat()); - num_tmp = ui->text_x4->toPlainText(); - if (!judge_int(num_tmp))return; - point[3][0] = (float) (num_tmp.toFloat()); - num_tmp = ui->text_y4->toPlainText(); - if (!judge_int(num_tmp))return; - point[3][1] = (float) (num_tmp.toFloat()); - change_view(); - pic.change = 1; -} -void MainWindow::on_action_2_triggered() { - qApp->quit(); -} -void MainWindow::on_about_triggered() { - QMessageBox MBox; - MBox.setWindowTitle("About RUBO IPM"); - MBox.setText("RUBO IPM 1.0.0"); - MBox.setInformativeText( - "Based on Qt 5.12.0 (MinGW 7.3.0 64 bit)\n\nBuilt on Aug 2 2022 10:33:33\n\nFrom revision 0.9.9\n\nChecked by RUBO\n\nTHIS PROGRAM IS ONLY PROVIDED FOR LEARNING AND\nCOMMUNICATION, AND HAS NOTHING TO DOWITH ANY\nSCHOOL OR ORGANIZATION. ANY FORM OF COMMERCIAL\nUSE IS PROHIBITED."); - MBox.setIconPixmap(QPixmap(":RUBO1-small.png")); - QPushButton *agreeBut = MBox.addButton("Close", QMessageBox::AcceptRole); - MBox.exec(); -} -void MainWindow::on_open_triggered() { - on_button_openpic_clicked(); -} diff --git a/QT Source/mainwindow.h b/QT Source/mainwindow.h deleted file mode 100644 index f8b49fd..0000000 --- a/QT Source/mainwindow.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include -#include "opencv2/opencv.hpp" -#include "qlabel.h" -#include "qdebug.h" -#include "bits/stdc++.h" -#include "qtimer.h" -#include"QFileDialog.h" -#include -#include -#include -#include -#include -#include -#include -#include "rubo_label.h" -#include -#include -#include -#include -#include -#include -#include -#include - -/***********************************RUBO HEADFILE*********************************/ -#include "change-view.h" -using namespace std; -using namespace cv; -namespace Ui { -class MainWindow; - -} -class myLabel; -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - MainWindow(QWidget *parent = nullptr); - ~MainWindow(); - Ui::MainWindow *ui; - myLabel* mylabel; - -private slots: - void on_button_openpic_clicked(); - void QString_to_string(QString a,string *b); - void init_windows(int start_width,int start_high); - void update_windows(); - void init_model1_windows(int start_x,int start_y); - void init_model2_windows(int start_x,int start_y); - void init_model3_windows(int start_x,int start_y); - void init_model4_windows(int model4_start_x,int model4_start_y); - void init_model5_windows(int model5_start_x,int model5_start_y); - void open_pic_update_windows(); - void open_mainwindows_updata_windows(); - void active_windows(); - bool judge_int(QString a); - - void on_button_clear_clicked(); -protected: -private slots: - void timerUpdate(); - - - void on_action_2_triggered(); - - void on_button_change_clicked(); - -// void on_action_2_triggered(); - - void on_about_triggered(); - - void on_open_triggered(); - -private: - int id1; - - -}; -struct pic_show{ - int width; - int high; - int show_width; - int show_high; - int zoom; - int click_cnt; - bool PIC_OPEN; - bool change; -}; -extern int screenX,screenY; - -extern pic_show pic; -#if defined(_MSC_VER) && (_MSC_VER >= 1600) -# pragma execution_character_set("utf-8") -#endif -#endif // MAINWINDOW_H diff --git a/QT Source/mainwindow.ui b/QT Source/mainwindow.ui deleted file mode 100644 index 2b6543a..0000000 --- a/QT Source/mainwindow.ui +++ /dev/null @@ -1,457 +0,0 @@ - - - MainWindow - - - - 0 - 0 - 1200 - 650 - - - - RUBO IPM - - - QToolBar{border-color: rgb(0, 0, 0);border:1px solid;} - - - true - - - - - - 1050 - 460 - 93 - 28 - - - - 打开图片 - - - - - - 1050 - 500 - 93 - 28 - - - - 透视变换 - - - - - - 1100 - 70 - 60 - 30 - - - - - - - 1000 - 80 - 91 - 16 - - - - 结果图高度: - - - - - - 950 - 130 - 141 - 16 - - - - 方形中心距顶部像素: - - - - - - 1100 - 120 - 60 - 30 - - - - - - - 1100 - 20 - 60 - 30 - - - - - - - 1000 - 30 - 91 - 16 - - - - 结果图宽度: - - - - - - 1000 - 180 - 141 - 16 - - - - 方形像素边长: - - - - - - 1100 - 170 - 60 - 30 - - - - - - - 1000 - 230 - 21 - 16 - - - - X1: - - - - - - 1100 - 230 - 21 - 16 - - - - Y1: - - - - - - 1030 - 220 - 60 - 30 - - - - - - - 1130 - 220 - 60 - 30 - - - - - - - 1130 - 270 - 60 - 30 - - - - - - - 1030 - 270 - 60 - 30 - - - - - - - 1030 - 320 - 60 - 30 - - - - - - - 1030 - 370 - 60 - 30 - - - - - - - 1130 - 320 - 60 - 30 - - - - - - - 1130 - 370 - 60 - 30 - - - - - - - 1000 - 280 - 21 - 16 - - - - X2: - - - - - - 1000 - 330 - 21 - 16 - - - - X3: - - - - - - 1000 - 380 - 21 - 16 - - - - X4: - - - - - - 1100 - 280 - 21 - 16 - - - - Y2: - - - - - - 1100 - 330 - 21 - 16 - - - - Y3: - - - - - - 1100 - 380 - 20 - 20 - - - - Y4: - - - - - - 0 - 0 - 940 - 600 - - - - - - - Qt::PlainText - - - - - - 1050 - 420 - 93 - 28 - - - - 清除 - - - - - - 0 - 605 - 1200 - 16 - - - - 提示: - - - label_pic1 - button_openpic - button_change - text_high - label_high - label_ysite - text_ysite - text_width - label_width - label_len - text_len - label_x1 - label_y1 - text_x1 - text_y1 - text_y2 - text_x2 - text_x3 - text_x4 - text_y3 - text_y4 - label_x2 - label_x3 - label_x4 - label_y2 - label_y3 - label_y4 - button_clear - label_tips - - - - - 0 - 0 - 1200 - 26 - - - - - 文件 - - - - - - - - - - 打开图片 - - - 打开图片 - - - Ctrl+O - - - - - 关于 - - - 关于 - - - Ctrl+A - - - - - 退出 - - - Ctrl+Q - - - - - - - myLabel - QLabel -
rubo_label.h
-
-
- - -
diff --git a/QT Source/rubo.qrc b/QT Source/rubo.qrc deleted file mode 100644 index ca0473e..0000000 --- a/QT Source/rubo.qrc +++ /dev/null @@ -1,9 +0,0 @@ - - - RUBO1.png - RUBO2.png - RUBO1-small.png - RUBO1-tou.png - RUBO1-tou.ico - - diff --git a/QT Source/rubo_label.cpp b/QT Source/rubo_label.cpp deleted file mode 100644 index f59b78f..0000000 --- a/QT Source/rubo_label.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" -#include -#include -mouse mouse_flag ; -void mouse_init() -{ - mouse_flag.click=0; - mouse_flag.enter=0; - mouse_flag.x=0; - mouse_flag.y=0; - mouse_flag.move=0; - pic.click_cnt=0; - - -} -myLabel::myLabel(QWidget *parent) :QLabel(parent) - -{ - setMouseTracking(true); - -} - -void myLabel::mousePressEvent(QMouseEvent *ev) -{ - if(!pic.PIC_OPEN)return; - mouse_flag.move=0; - - if(ev->button()==Qt::LeftButton) - { - - mouse_flag.click=1; - } - if(ev->button()==Qt::RightButton) - { - if( pic.click_cnt<=4) pic.click_cnt++; - - - mouse_flag.click=2; - - } - -} -//鼠标进入事件 -void myLabel::enterEvent(QEvent *event) -{ - mouse_flag.enter=1; - -} -//鼠标离开事件 -void myLabel::leaveEvent(QEvent * ) -{ - mouse_flag.enter=0; -} - -void myLabel::mouseMoveEvent(QMouseEvent *ev) -{ - if(!pic.PIC_OPEN)return; - if(mouse_flag.click==2)return; - mouse_flag.x=ev->x()/pic.zoom; - mouse_flag.y=ev->y()/pic.zoom; - mouse_flag.move=1; - - -} - diff --git a/QT Source/rubo_label.h b/QT Source/rubo_label.h deleted file mode 100644 index 07996ee..0000000 --- a/QT Source/rubo_label.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef RUBO_LABEL_H -#define RUBO_LABEL_H -#include -#include "mainwindow.h" - -class MainWindow; - -class myLabel : public QLabel -{ - Q_OBJECT -public: - - myLabel(QWidget *parent = nullptr); - - //鼠标进入事件 - void enterEvent(QEvent *event); - //鼠标离开事件 - void leaveEvent(QEvent *event); - void mousePressEvent(QMouseEvent *ev); - - void mouseMoveEvent(QMouseEvent *ev); - -signals: -}; -void mouse_init(); - - -struct mouse -{ - bool enter; - int x,y; - int click; //0 1l 2r - bool move; -}; -extern mouse mouse_flag ; - -#endif // RUBO_LABEL_H diff --git a/QT Source/rubo_window.h b/QT Source/rubo_window.h deleted file mode 100644 index 2ef2379..0000000 --- a/QT Source/rubo_window.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef RUBO_WINDOW_H -#define RUBO_WINDOW_H -#include "mainwindow.h" -#include "ui_mainwindow.h" -using namespace std; -using namespace cv; - - -#endif // RUBO_WINDOW_H diff --git a/dll/D3Dcompiler_47.dll b/dll/D3Dcompiler_47.dll new file mode 100644 index 0000000..56512f5 Binary files /dev/null and b/dll/D3Dcompiler_47.dll differ diff --git a/dll/Qt5Core.dll b/dll/Qt5Core.dll new file mode 100644 index 0000000..6aa0bbc Binary files /dev/null and b/dll/Qt5Core.dll differ diff --git a/dll/Qt5Gui.dll b/dll/Qt5Gui.dll new file mode 100644 index 0000000..0a557c1 Binary files /dev/null and b/dll/Qt5Gui.dll differ diff --git a/dll/Qt5Svg.dll b/dll/Qt5Svg.dll new file mode 100644 index 0000000..1ae2380 Binary files /dev/null and b/dll/Qt5Svg.dll differ diff --git a/dll/Qt5Widgets.dll b/dll/Qt5Widgets.dll new file mode 100644 index 0000000..63cd78d Binary files /dev/null and b/dll/Qt5Widgets.dll differ diff --git a/dll/iconengines/qsvgicon.dll b/dll/iconengines/qsvgicon.dll new file mode 100644 index 0000000..271b3cb Binary files /dev/null and b/dll/iconengines/qsvgicon.dll differ diff --git a/dll/imageformats/qgif.dll b/dll/imageformats/qgif.dll new file mode 100644 index 0000000..9e117f9 Binary files /dev/null and b/dll/imageformats/qgif.dll differ diff --git a/dll/imageformats/qicns.dll b/dll/imageformats/qicns.dll new file mode 100644 index 0000000..287d439 Binary files /dev/null and b/dll/imageformats/qicns.dll differ diff --git a/dll/imageformats/qico.dll b/dll/imageformats/qico.dll new file mode 100644 index 0000000..d3810e6 Binary files /dev/null and b/dll/imageformats/qico.dll differ diff --git a/dll/imageformats/qjpeg.dll b/dll/imageformats/qjpeg.dll new file mode 100644 index 0000000..c1f7531 Binary files /dev/null and b/dll/imageformats/qjpeg.dll differ diff --git a/dll/imageformats/qsvg.dll b/dll/imageformats/qsvg.dll new file mode 100644 index 0000000..842099e Binary files /dev/null and b/dll/imageformats/qsvg.dll differ diff --git a/dll/imageformats/qtga.dll b/dll/imageformats/qtga.dll new file mode 100644 index 0000000..f1cb4c7 Binary files /dev/null and b/dll/imageformats/qtga.dll differ diff --git a/dll/imageformats/qtiff.dll b/dll/imageformats/qtiff.dll new file mode 100644 index 0000000..9788256 Binary files /dev/null and b/dll/imageformats/qtiff.dll differ diff --git a/dll/imageformats/qwbmp.dll b/dll/imageformats/qwbmp.dll new file mode 100644 index 0000000..01961bd Binary files /dev/null and b/dll/imageformats/qwbmp.dll differ diff --git a/dll/imageformats/qwebp.dll b/dll/imageformats/qwebp.dll new file mode 100644 index 0000000..3674dba Binary files /dev/null and b/dll/imageformats/qwebp.dll differ diff --git a/dll/libEGL.dll b/dll/libEGL.dll new file mode 100644 index 0000000..3529e16 Binary files /dev/null and b/dll/libEGL.dll differ diff --git a/dll/libGLESV2.dll b/dll/libGLESV2.dll new file mode 100644 index 0000000..ff5ce4b Binary files /dev/null and b/dll/libGLESV2.dll differ diff --git a/dll/libgcc_s_seh-1.dll b/dll/libgcc_s_seh-1.dll new file mode 100644 index 0000000..4ec945b Binary files /dev/null and b/dll/libgcc_s_seh-1.dll differ diff --git a/dll/libopencv_core401.dll b/dll/libopencv_core401.dll new file mode 100644 index 0000000..1905ff1 Binary files /dev/null and b/dll/libopencv_core401.dll differ diff --git a/dll/libopencv_highgui401.dll b/dll/libopencv_highgui401.dll new file mode 100644 index 0000000..6c18b0e Binary files /dev/null and b/dll/libopencv_highgui401.dll differ diff --git a/dll/libopencv_imgcodecs401.dll b/dll/libopencv_imgcodecs401.dll new file mode 100644 index 0000000..1b053ea Binary files /dev/null and b/dll/libopencv_imgcodecs401.dll differ diff --git a/dll/libopencv_imgproc401.dll b/dll/libopencv_imgproc401.dll new file mode 100644 index 0000000..7d7fa12 Binary files /dev/null and b/dll/libopencv_imgproc401.dll differ diff --git a/dll/libstdc++-6.dll b/dll/libstdc++-6.dll new file mode 100644 index 0000000..8e55acc Binary files /dev/null and b/dll/libstdc++-6.dll differ diff --git a/dll/libwinpthread-1.dll b/dll/libwinpthread-1.dll new file mode 100644 index 0000000..d9f4e1a Binary files /dev/null and b/dll/libwinpthread-1.dll differ diff --git a/dll/opengl32sw.dll b/dll/opengl32sw.dll new file mode 100644 index 0000000..475e82a Binary files /dev/null and b/dll/opengl32sw.dll differ diff --git a/dll/platforms/qwindows.dll b/dll/platforms/qwindows.dll new file mode 100644 index 0000000..4227915 Binary files /dev/null and b/dll/platforms/qwindows.dll differ diff --git a/dll/styles/qwindowsvistastyle.dll b/dll/styles/qwindowsvistastyle.dll new file mode 100644 index 0000000..5c0159f Binary files /dev/null and b/dll/styles/qwindowsvistastyle.dll differ