diff --git a/src/main/mainwindow.cpp b/src/main/mainwindow.cpp index ea30a81..8e44df4 100644 --- a/src/main/mainwindow.cpp +++ b/src/main/mainwindow.cpp @@ -360,4 +360,27 @@ void MainWindow::setBtnStyles(){ "QPushButton:pressed{border-image: url(://images/down_right_2.png)}"); ui->pushButton_Right_Back->setFlat(true); + +} +void MainWindow::importFrame() +{ + capture >> frame; + cvtColor(frame, frame, CV_BGR2RGB); + QImage srcQImage = QImage((uchar*)(frame.data), frame.cols, frame.rows, QImage::Format_RGB888); + ui->tello_receiver->setPixmap(QPixmap::fromImage(srcQImage)); + ui->tello_receiver->resize(srcQImage.size()); + ui->tello_receiver->show(); +} + +void MainWindow::on_Open_receive_clicked() +{ + capture.open(1); + //capture.open("udp://@0.0.0.0:11111"); + timer->start(30); +} + +void MainWindow::on_Stop_receive_clicked() +{ + timer->stop(); + capture.release(); } diff --git a/src/ui/Triplet/mainwindow.cpp b/src/ui/Triplet/mainwindow.cpp index 5a195f4..7365b8c 100644 --- a/src/ui/Triplet/mainwindow.cpp +++ b/src/ui/Triplet/mainwindow.cpp @@ -43,3 +43,9 @@ void MainWindow::on_CLOSE_clicked() timer->stop(); capture.release(); } + + + + + + diff --git a/src/ui/mainwindow.hpp b/src/ui/mainwindow.hpp index 01eb5b1..6a9cb94 100644 --- a/src/ui/mainwindow.hpp +++ b/src/ui/mainwindow.hpp @@ -4,13 +4,14 @@ #include #include #include - +#include #include "ui_mainwindow.h" #include "../include/joystick.h" #include "../include/qnode.hpp" #include "../include/dashboard.h" #include +using namespace cv; namespace Ui { class MainWindow; } @@ -45,10 +46,16 @@ public slots: void slot_batteryState(sensor_msgs::BatteryState); void Slider_raw_valueChanged(int v); void Slider_linear_valueChanged(int v); - + void importFrame();//read video void slot_show_image(QImage image);//added +private slots: + void on_Stop_receive_clicked(); + +private slots: + void on_Open_receive_clicked(); + private: Ui::MainWindow *ui; QNode qnode; @@ -56,6 +63,11 @@ private: DashBoard *m_DashBoard_x; DashBoard *m_DashBoard_th; + VideoCapture capture; + QTimer *timer; + Mat frame; + bool isCamerea = 0; + void initUis(); void setBtnStyles(); void connections(); diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui index b4841a7..219b7fe 100644 --- a/src/ui/mainwindow.ui +++ b/src/ui/mainwindow.ui @@ -98,7 +98,7 @@ - ../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui + ../../../Ros_Qt5_Gui_App/ui../../../Ros_Qt5_Gui_App/ui @@ -143,7 +143,7 @@ margin:0px 0px 0px 0px; - ../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui + ../../../Ros_Qt5_Gui_App/ui../../../Ros_Qt5_Gui_App/ui @@ -188,7 +188,7 @@ margin:0px 0px 0px 0px; - ../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui + ../../../Ros_Qt5_Gui_App/ui../../../Ros_Qt5_Gui_App/ui @@ -203,7 +203,7 @@ margin:0px 0px 0px 0px; - 2 + 1 @@ -224,8 +224,8 @@ margin:0px 0px 0px 0px; - 680 - 290 + 870 + 300 271 121 @@ -234,9 +234,126 @@ margin:0px 0px 0px 0px; UAV Widget + + + + 90 + 20 + 661 + 401 + + + + + 0 + 0 + + + + Logging + + + + + + + 600 + 270 + + + + CameraLabel + + + + + + + true + + + + 600 + 81 + + + + + 16777215 + 81 + + + + + + + + + + 90 + 420 + 661 + 81 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 211 + 71 + + + + Open + + + + + + + + 211 + 71 + + + + Stop + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - + 680 @@ -1135,7 +1252,7 @@ background-color: rgb(255,255,255); - + 21