修改部分界面 #42

Merged
pvqf6mep3 merged 1 commits from majian_branch into master 2 years ago

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

@ -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

@ -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<<Command<<endl;
system(Command.c_str());
@ -18,10 +18,8 @@ void ATR::runCommand(){
void ATR::getSolvedPic(){
string Path = "/home/cyber/Study/Codes/catkin_ws/src/Air_Ground_CEC/src/YOLOv6/runs/inference/exp/";
string SolvedPicPath = Path + "x.jpg";
sprintf(filename, SolvedPicPath.c_str());
SolvedImg = cv::imread(filename);
QImage image = QImage(SolvedImg.data,SolvedImg.cols,SolvedImg.rows,SolvedImg.step[0],QImage::Format_RGB888);
string SolvedPicPath = Path + "test.jpg";
QImage image = QImage(SolvedPicPath.c_str());
std::cout<<"image"<<endl;
emit show_solvedImage(image);
}

@ -209,8 +209,14 @@ void MainWindow::connections(){
}
void MainWindow::slot_get_slovedImage(){
atr.runCommand();
atr.getSolvedPic();
qnode.setissaveImageTrue();
while(true){
if(qnode.issaveImage == false){
atr.runCommand();
atr.getSolvedPic();
break;
}
}
}
void MainWindow::slot_speed_x(double x) {
@ -259,14 +265,20 @@ void MainWindow::slot_show_image(const QImage& image)
{
//qimage_mutex_.lock();
//qimage_ = image.copy();
ui->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(){

@ -6,7 +6,7 @@
#include <QtConcurrent/QtConcurrent>
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)

@ -203,7 +203,7 @@ margin:0px 0px 0px 0px;
<item row="0" column="0">
<widget class="QStackedWidget" name="stackedWidget_main">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="mainWidget">
<widget class="QLabel" name="label_2">
@ -211,10 +211,22 @@ margin:0px 0px 0px 0px;
<rect>
<x>240</x>
<y>10</y>
<width>851</width>
<height>491</height>
<width>741</width>
<height>511</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>741</width>
<height>511</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>741</width>
<height>511</height>
</size>
</property>
<property name="text">
<string>Main Widget</string>
</property>
@ -369,8 +381,8 @@ margin:0px 0px 0px 0px;
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>680</x>
<y>10</y>
<x>690</x>
<y>0</y>
<width>735</width>
<height>750</height>
</rect>
@ -574,8 +586,49 @@ QProgressBar::chunk
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QLabel" name="label_target_text">
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="text">
<string>Target</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="solvedimage">
<property name="minimumSize">
@ -584,8 +637,14 @@ QProgressBar::chunk
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>270</width>
<height>200</height>
</size>
</property>
<property name="text">
<string>target</string>
<string>SolvedImage</string>
</property>
</widget>
</item>
@ -594,6 +653,9 @@ QProgressBar::chunk
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
@ -641,27 +703,27 @@ QProgressBar::chunk
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QStackedWidget" name="stackedWidget_ros_control">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="keyboard_control">
<layout class="QHBoxLayout" name="horizontalLayout_3">
@ -1268,10 +1330,10 @@ background-color: rgb(255,255,255);
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>21</x>
<x>31</x>
<y>1</y>
<width>660</width>
<height>756</height>
<width>651</width>
<height>751</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
@ -1283,6 +1345,18 @@ background-color: rgb(255,255,255);
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>400</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>400</height>
</size>
</property>
<property name="title">
<string>Logging</string>
</property>
@ -1291,32 +1365,19 @@ background-color: rgb(255,255,255);
<widget class="QLabel" name="label_camera">
<property name="minimumSize">
<size>
<width>600</width>
<height>270</height>
</size>
</property>
<property name="text">
<string>CameraLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="view_logging_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>81</height>
<width>620</width>
<height>360</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>81</height>
<width>620</width>
<height>360</height>
</size>
</property>
<property name="text">
<string>CameraLabel</string>
</property>
</widget>
</item>
</layout>
@ -1334,6 +1395,12 @@ background-color: rgb(255,255,255);
<height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -1346,7 +1413,13 @@ background-color: rgb(255,255,255);
<property name="minimumSize">
<size>
<width>160</width>
<height>30</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>29</height>
</size>
</property>
<property name="text">
@ -1372,7 +1445,13 @@ background-color: rgb(255,255,255);
<property name="minimumSize">
<size>
<width>60</width>
<height>35</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="text">
@ -1407,6 +1486,12 @@ background-color: rgb(255,255,255);
<height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -1422,6 +1507,12 @@ background-color: rgb(255,255,255);
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>x 轴线速度</string>
</property>
@ -1434,8 +1525,8 @@ background-color: rgb(255,255,255);
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<width>0</width>
<height>30</height>
</size>
</property>
</spacer>
@ -1445,7 +1536,13 @@ background-color: rgb(255,255,255);
<property name="minimumSize">
<size>
<width>60</width>
<height>35</height>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="text">

Loading…
Cancel
Save