diff --git a/src/YOLOv6/imgdir/test.jpg b/src/YOLOv6/imgdir/test.jpg new file mode 100644 index 0000000..b2b3187 Binary files /dev/null and b/src/YOLOv6/imgdir/test.jpg differ diff --git a/src/YOLOv6/runs/inference/exp/test.jpg b/src/YOLOv6/runs/inference/exp/test.jpg new file mode 100644 index 0000000..1ddcf3c Binary files /dev/null and b/src/YOLOv6/runs/inference/exp/test.jpg differ diff --git a/src/include/Air_Ground_CEC/qnode.hpp b/src/include/Air_Ground_CEC/qnode.hpp index e325147..3ff2034 100644 --- a/src/include/Air_Ground_CEC/qnode.hpp +++ b/src/include/Air_Ground_CEC/qnode.hpp @@ -41,6 +41,10 @@ public: //void subImage(); QImage image; + bool issaveImage = false; + void setissaveImageTrue(); + void setissaveImageFalse(); + Q_SIGNALS: void speed_x(double x); @@ -80,6 +84,8 @@ private: QImage Mat2QImage(cv::Mat const &src); cv::Mat QImage2Mat(QImage &image); + + }; #endif diff --git a/src/main/atr.cpp b/src/main/atr.cpp index 6332524..8017f02 100644 --- a/src/main/atr.cpp +++ b/src/main/atr.cpp @@ -1,7 +1,7 @@ #include "../include/Air_Ground_CEC/atr.h" using namespace std; #include "stdlib.h" -char filename[100]; + ATR::ATR() { @@ -10,7 +10,7 @@ ATR::ATR() void ATR::runCommand(){ string ws = "cd /home/cyber/Study/Codes/catkin_ws/src/Air_Ground_CEC/src/YOLOv6"; string CMD = "python3 ../YOLOv6/tools/infer.py --weights ../YOLOv6/yolov6n.pt --source ../YOLOv6/imgdir/"; - string Pic = "x.jpg"; + string Pic = "test.jpg"; string Command = ws + "&&" + CMD + Pic; std::cout<label_camera->setScaledContents(true); ui->label_camera->setPixmap(QPixmap::fromImage(image)); ui->label_camera->resize(ui->label_camera->pixmap()->size()); //qimage_mutex_.unlock(); } void MainWindow::slot_show_solvedImage(const QImage& solvedImage){ + ui->label_2->setScaledContents(true); ui->label_2->setPixmap(QPixmap::fromImage(solvedImage)); ui->label_2->resize(ui->label_2->pixmap()->size()); + + ui->solvedimage->setScaledContents(true); + ui->solvedimage->setPixmap(QPixmap::fromImage(solvedImage)); + ui->solvedimage->resize(ui->solvedimage->pixmap()->size()); } void MainWindow::setBtnStyles(){ diff --git a/src/main/qnode.cpp b/src/main/qnode.cpp index 58b6cb3..f6344f0 100644 --- a/src/main/qnode.cpp +++ b/src/main/qnode.cpp @@ -6,7 +6,7 @@ #include QNode::QNode(int argc, char **argv) : init_argc(argc), init_argv(argv){ - + issaveImage = false; } @@ -34,6 +34,14 @@ bool QNode::init() { return true; } +void QNode::setissaveImageTrue(){ + issaveImage = true; +} + +void QNode::setissaveImageFalse(){ + issaveImage = false; +} + void QNode::SubAndPubTopic(){ ros::NodeHandle n; @@ -48,7 +56,7 @@ void QNode::SubAndPubTopic(){ &QNode::batteryCallback, this); image_transport::ImageTransport it(n); - //camera/rgb/image_raw + //camera/rgb/image_raw raspicam_node/image image_sub = it.subscribe("raspicam_node/image", 10, &QNode::imageCallback, this); //image_sub0 = n.subscribe("camera/rgb/image_raw",100,&QNode::imageCallback,this) @@ -179,7 +187,7 @@ void QNode::speedCallback(const nav_msgs::Odometry::ConstPtr& msg) void QNode::imageCallback(const sensor_msgs::ImageConstPtr &msg) { - ROS_INFO("i am ok"); + //ROS_INFO("i am ok"); try { cv_bridge::CvImageConstPtr cv_ptr = @@ -187,7 +195,12 @@ void QNode::imageCallback(const sensor_msgs::ImageConstPtr &msg) cv::Mat img = cv_ptr->image; QImage image = QImage(img.data,img.cols,img.rows,img.step[0],QImage::Format_RGB888);//change to QImage format //ROS_INFO("I'm setting picture in mul_t callback function!"); - //image.save("/home/jackyma/test.jpg"); + if(issaveImage){ + string path = "/home/cyber/Study/Codes/catkin_ws/src/Air_Ground_CEC/src/YOLOv6/imgdir/"; + image.save((path + "test.jpg").c_str()); + issaveImage = false; + } + emit show_image(image); } catch (cv_bridge::Exception& e) diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui index 46c53e7..59f3da4 100644 --- a/src/ui/mainwindow.ui +++ b/src/ui/mainwindow.ui @@ -203,7 +203,7 @@ margin:0px 0px 0px 0px; - 0 + 2 @@ -211,10 +211,22 @@ margin:0px 0px 0px 0px; 240 10 - 851 - 491 + 741 + 511 + + + 741 + 511 + + + + + 741 + 511 + + Main Widget @@ -369,8 +381,8 @@ margin:0px 0px 0px 0px; - 680 - 10 + 690 + 0 735 750 @@ -574,8 +586,49 @@ QProgressBar::chunk + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + 18 + + + + Target + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 0 + 20 + + + + @@ -584,8 +637,14 @@ QProgressBar::chunk 200 + + + 270 + 200 + + - target + SolvedImage @@ -594,6 +653,9 @@ QProgressBar::chunk Qt::Vertical + + QSizePolicy::Fixed + 20 @@ -641,27 +703,27 @@ QProgressBar::chunk + + + + Qt::Vertical + + + + 20 + 40 + + + + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - 1 + 0 @@ -1268,10 +1330,10 @@ background-color: rgb(255,255,255); - 21 + 31 1 - 660 - 756 + 651 + 751 @@ -1283,6 +1345,18 @@ background-color: rgb(255,255,255); 0 + + + 0 + 400 + + + + + 16777215 + 400 + + Logging @@ -1291,32 +1365,19 @@ background-color: rgb(255,255,255); - 600 - 270 - - - - CameraLabel - - - - - - - true - - - - 600 - 81 + 620 + 360 - 16777215 - 81 + 620 + 360 + + CameraLabel + @@ -1334,6 +1395,12 @@ background-color: rgb(255,255,255); 300 + + + 300 + 300 + + @@ -1346,7 +1413,13 @@ background-color: rgb(255,255,255); 160 - 30 + 20 + + + + + 160 + 29 @@ -1372,7 +1445,13 @@ background-color: rgb(255,255,255); 60 - 35 + 20 + + + + + 60 + 30 @@ -1407,6 +1486,12 @@ background-color: rgb(255,255,255); 300 + + + 300 + 300 + + @@ -1422,6 +1507,12 @@ background-color: rgb(255,255,255); 30 + + + 160 + 30 + + x 轴线速度 @@ -1434,8 +1525,8 @@ background-color: rgb(255,255,255); - 40 - 20 + 0 + 30 @@ -1445,7 +1536,13 @@ background-color: rgb(255,255,255); 60 - 35 + 30 + + + + + 60 + 30