|
|
@ -3,18 +3,26 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include <QDateTime> |
|
|
|
#include <QDateTime> |
|
|
|
#include <QDesktopServices> |
|
|
|
#include <QDesktopServices> |
|
|
|
|
|
|
|
#include <QDebug> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) |
|
|
|
MainWindow::MainWindow(QWidget *parent) |
|
|
|
: QMainWindow(parent) |
|
|
|
: QMainWindow(parent) |
|
|
|
, ui(new Ui::MainWindow) |
|
|
|
, ui(new Ui::MainWindow) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ui->setupUi(this); |
|
|
|
ui->setupUi(this); |
|
|
|
|
|
|
|
|
|
|
|
initIns(); |
|
|
|
initIns(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initUI(); |
|
|
|
initUI(); |
|
|
|
|
|
|
|
|
|
|
|
initConnect(); |
|
|
|
initConnect(); |
|
|
|
#if CLIENT==1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#if CLIENT==1
|
|
|
|
hideui(); |
|
|
|
hideui(); |
|
|
|
#endif |
|
|
|
//#endif
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow() |
|
|
|
MainWindow::~MainWindow() |
|
|
@ -68,8 +76,10 @@ void MainWindow::initUI() |
|
|
|
ui->toolbox->addItem(m2,u8"算法设置"); |
|
|
|
ui->toolbox->addItem(m2,u8"算法设置"); |
|
|
|
ui->toolbox->addItem(m3,u8"显示设置"); |
|
|
|
ui->toolbox->addItem(m3,u8"显示设置"); |
|
|
|
ui->toolbox->addItem(m4,u8"保存设置"); |
|
|
|
ui->toolbox->addItem(m4,u8"保存设置"); |
|
|
|
ui->toolbox->addItem(m5,u8"多点校正"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if CLIENT==2 |
|
|
|
|
|
|
|
ui->toolbox->addItem(m5,u8"多点校正"); |
|
|
|
|
|
|
|
#endif |
|
|
|
type = gray16; |
|
|
|
type = gray16; |
|
|
|
rows = ui->spinBox->value(); |
|
|
|
rows = ui->spinBox->value(); |
|
|
|
cols = ui->spinBox_2->value(); |
|
|
|
cols = ui->spinBox_2->value(); |
|
|
@ -103,9 +113,12 @@ void MainWindow::initUI() |
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::initConnect() |
|
|
|
void MainWindow::initConnect() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(ucontrol,SIGNAL(signalSendMessage(QString)),this,SLOT(slotlogtext(QString))); |
|
|
|
connect(ucontrol,SIGNAL(signalSendMessage(QString)),this,SLOT(slotlogtext(QString))); |
|
|
|
connect(usb,SIGNAL(signalMessage(QString)),this,SLOT(slotlogtext(QString))); |
|
|
|
connect(usb,SIGNAL(signalMessage(QString)),this,SLOT(slotlogtext(QString))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(m1,SIGNAL(signalsetGPOL(int)),ucontrol,SLOT(setGPOL(int))); |
|
|
|
connect(m1,SIGNAL(signalsetGPOL(int)),ucontrol,SLOT(setGPOL(int))); |
|
|
|
connect(m1,SIGNAL(signalsetIT(double)),ucontrol,SLOT(setIT(double))); |
|
|
|
connect(m1,SIGNAL(signalsetIT(double)),ucontrol,SLOT(setIT(double))); |
|
|
|
connect(m1,SIGNAL(signalopenTEC(bool)),ucontrol,SLOT(tec(bool))); |
|
|
|
connect(m1,SIGNAL(signalopenTEC(bool)),ucontrol,SLOT(tec(bool))); |
|
|
@ -122,6 +135,7 @@ void MainWindow::initConnect() |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if CLIENT == 0 || CLIENT==1 |
|
|
|
#if CLIENT == 0 || CLIENT==1 |
|
|
|
connect(usb,SIGNAL(signalGetImage(cv::Mat)),this,SLOT(slotShowImage(cv::Mat))); |
|
|
|
connect(usb,SIGNAL(signalGetImage(cv::Mat)),this,SLOT(slotShowImage(cv::Mat))); |
|
|
|
|
|
|
|
|
|
|
@ -135,19 +149,17 @@ void MainWindow::initConnect() |
|
|
|
connect(m1,SIGNAL(signalsaveb()),ucontrol,SLOT(saveb())); |
|
|
|
connect(m1,SIGNAL(signalsaveb()),ucontrol,SLOT(saveb())); |
|
|
|
connect(m1,SIGNAL(signalopenb(bool)),ucontrol,SLOT(openb(bool))); |
|
|
|
connect(m1,SIGNAL(signalopenb(bool)),ucontrol,SLOT(openb(bool))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(m2,SIGNAL(signalsag(bool)),ucontrol,SLOT(setsag(bool))); |
|
|
|
connect(m2,SIGNAL(signalsag(bool)),ucontrol,SLOT(setsag(bool))); |
|
|
|
connect(m2,SIGNAL(signalsetDDE(int)),ucontrol,SLOT(setDDE(int))); |
|
|
|
connect(m2,SIGNAL(signalsetDDE(int)),ucontrol,SLOT(setDDE(int))); |
|
|
|
connect(m2,SIGNAL(signalsetkf(int)),ucontrol,SLOT(setkf(int))); |
|
|
|
connect(m2,SIGNAL(signalsetkf(int)),ucontrol,SLOT(setkf(int))); |
|
|
|
connect(m2,SIGNAL(signalsethist(int)),ucontrol,SLOT(sethist(int))); |
|
|
|
connect(m2,SIGNAL(signalsethist(int)),ucontrol,SLOT(sethist(int))); |
|
|
|
// connect(m2,SIGNAL(signalsetDE(bool)),)
|
|
|
|
|
|
|
|
// connect(m2,SIGNAL(signalseterate(double)),)
|
|
|
|
|
|
|
|
// connect(m2,SIGNAL(signalsetbright(int)),)
|
|
|
|
|
|
|
|
///线性拉伸设置
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
#elif CLIENT==2 |
|
|
|
#elif CLIENT==2 |
|
|
|
// connect(usb,SIGNAL(signalGetImage(cv::Mat)),m_tp,SLOT(slotprocimg(cv::Mat)));
|
|
|
|
// connect(usb,SIGNAL(signalGetImage(cv::Mat)),m_tp,SLOT(slotprocimg(cv::Mat)));
|
|
|
|
// connect(m_tp,SIGNAL(signalsendimg(cv::Mat)),m_avg,SLOT(slotprocimg(cv::Mat)));
|
|
|
|
// connect(m_tp,SIGNAL(signalsendimg(cv::Mat)),m_avg,SLOT(slotprocimg(cv::Mat)));
|
|
|
|
|
|
|
|
|
|
|
|
connect(usb,SIGNAL(signalGetImage(cv::Mat)),m_mp,SLOT(runData(cv::Mat))); |
|
|
|
connect(usb,SIGNAL(signalGetImage(cv::Mat)),m_mp,SLOT(runData(cv::Mat))); |
|
|
|
connect(m_mp,SIGNAL(signalsendimg(cv::Mat)),m_avg,SLOT(slotprocimg(cv::Mat))); |
|
|
|
connect(m_mp,SIGNAL(signalsendimg(cv::Mat)),m_avg,SLOT(slotprocimg(cv::Mat))); |
|
|
|
|
|
|
|
|
|
|
@ -218,7 +230,13 @@ void MainWindow::initConnect() |
|
|
|
m_clhe->setthreshold(value); |
|
|
|
m_clhe->setthreshold(value); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(m5,SIGNAL(signalsave()),m_mp,SLOT(save())); |
|
|
|
|
|
|
|
connect(m5,SIGNAL(signalcalc(QVector<double>)),m_mp,SLOT(calcData(QVector<double>))); |
|
|
|
|
|
|
|
connect(m5,SIGNAL(signalsavedata(QString)),m_mp,SLOT(savedata(QString))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(m_mp,SIGNAL(signalNewFrame(double)),m5,SLOT(slotRefresh(double))); |
|
|
|
|
|
|
|
connect(m5,SIGNAL(signalloaddata(QString)),m_mp,SLOT(loaddata(QString))); |
|
|
|
|
|
|
|
connect(m5,SIGNAL(signaloff()),m_mp,SLOT(off())); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
connect(m2,&menu2::signalsetDE,[=](bool b){ |
|
|
|
connect(m2,&menu2::signalsetDE,[=](bool b){ |
|
|
@ -263,6 +281,7 @@ void MainWindow::initConnect() |
|
|
|
connect(m3,&menu3::signalcolorrgb,[=](){ |
|
|
|
connect(m3,&menu3::signalcolorrgb,[=](){ |
|
|
|
colortype = 2; |
|
|
|
colortype = 2; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
qDebug()<<__LINE__; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(m4,&menu4::signalsetdir,[=](QString dir){ |
|
|
|
connect(m4,&menu4::signalsetdir,[=](QString dir){ |
|
|
@ -283,6 +302,8 @@ void MainWindow::initConnect() |
|
|
|
connect(m4,&menu4::signalshotbin,[=](){ |
|
|
|
connect(m4,&menu4::signalshotbin,[=](){ |
|
|
|
shotbin = true; |
|
|
|
shotbin = true; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(m4,&menu4::signalsavevideo,[=](bool b){ |
|
|
|
connect(m4,&menu4::signalsavevideo,[=](bool b){ |
|
|
|
if(b){ |
|
|
|
if(b){ |
|
|
|
if(fps<10) |
|
|
|
if(fps<10) |
|
|
@ -327,6 +348,7 @@ void MainWindow::initConnect() |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(m4,&menu4::signalsavesbin,[=](int frames){ |
|
|
|
connect(m4,&menu4::signalsavesbin,[=](int frames){ |
|
|
|
if(savesbin) |
|
|
|
if(savesbin) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -344,12 +366,11 @@ void MainWindow::initConnect() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(m5,SIGNAL(signalsave()),m_mp,SLOT(save())); |
|
|
|
|
|
|
|
connect(m5,SIGNAL(signalcalc()),m_mp,SLOT(calcData())); |
|
|
|
|
|
|
|
connect(m5,SIGNAL(signalsavedata()),m_mp,SLOT(savedata())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(lpath,&QPushButton::clicked,[=](){ |
|
|
|
connect(lpath,&QPushButton::clicked,[=](){ |
|
|
|
QDesktopServices::openUrl(QUrl(path)); |
|
|
|
QDesktopServices::openUrl(QUrl::fromLocalFile(path)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -392,6 +413,9 @@ void MainWindow::on_pushButton_2_clicked() |
|
|
|
|
|
|
|
|
|
|
|
usb->SetImageInfo(type,rows,cols); |
|
|
|
usb->SetImageInfo(type,rows,cols); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m1->opentec(); |
|
|
|
|
|
|
|
ucontrol->tec(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if CLIENT == 0 || CLIENT == 1 |
|
|
|
#if CLIENT == 0 || CLIENT == 1 |
|
|
|
ucontrol->setIT(5.0); |
|
|
|
ucontrol->setIT(5.0); |
|
|
@ -428,8 +452,8 @@ void MainWindow::on_pushButton_3_clicked() |
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::slotShowImage(cv::Mat img) |
|
|
|
void MainWindow::slotShowImage(cv::Mat img) |
|
|
|
{ |
|
|
|
{ |
|
|
|
cv::Mat o; |
|
|
|
|
|
|
|
cv::mean(img,o); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fpscount +=1; |
|
|
|
fpscount +=1; |
|
|
|
if(flip0){ |
|
|
|
if(flip0){ |
|
|
@ -452,7 +476,7 @@ void MainWindow::slotShowImage(cv::Mat img) |
|
|
|
spurefile->flush(); |
|
|
|
spurefile->flush(); |
|
|
|
} |
|
|
|
} |
|
|
|
sbinnum -=1; |
|
|
|
sbinnum -=1; |
|
|
|
// qDebug()<<sbinnum;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(sbinnum == 0){ |
|
|
|
if(sbinnum == 0){ |
|
|
|
spurefile->close(); |
|
|
|
spurefile->close(); |
|
|
@ -619,7 +643,7 @@ void MainWindow::slotShowImage(cv::Mat img) |
|
|
|
QString imgfile = path+ now+".png"; |
|
|
|
QString imgfile = path+ now+".png"; |
|
|
|
cv::imwrite(imgfile.toLocal8Bit().toStdString(),img); |
|
|
|
cv::imwrite(imgfile.toLocal8Bit().toStdString(),img); |
|
|
|
QString t =path+now+".tiff"; |
|
|
|
QString t =path+now+".tiff"; |
|
|
|
cv::imwrite(t.toStdString(),img); |
|
|
|
cv::imwrite(t.toLocal8Bit().toStdString(),img); |
|
|
|
|
|
|
|
|
|
|
|
QString filename = path+now+".bin"; |
|
|
|
QString filename = path+now+".bin"; |
|
|
|
|
|
|
|
|
|
|
@ -650,7 +674,7 @@ void MainWindow::slotShowImage(cv::Mat img) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// QPixmap pix = QPixmap::fromImage(img);
|
|
|
|
|
|
|
|
if(b_stat &(!b_fullscreen)){ |
|
|
|
if(b_stat &(!b_fullscreen)){ |
|
|
|
QPainter p(&pix); |
|
|
|
QPainter p(&pix); |
|
|
|
QPen pen = p.pen(); |
|
|
|
QPen pen = p.pen(); |
|
|
@ -728,11 +752,18 @@ void MainWindow::keyPressEvent(QKeyEvent *ev) |
|
|
|
imageY+=1; |
|
|
|
imageY+=1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((ev->modifiers() == Qt::ControlModifier) && (ev->key()== Qt::Key_A)){ |
|
|
|
|
|
|
|
m1->showui(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if((ev->modifiers() == Qt::ControlModifier) && (ev->key()== Qt::Key_Q)){ |
|
|
|
|
|
|
|
m1->hideui(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::initIns() |
|
|
|
void MainWindow::initIns() |
|
|
|
{ |
|
|
|
{ |
|
|
|
qRegisterMetaType<cv::Mat>("cv::Mat"); |
|
|
|
qRegisterMetaType<cv::Mat>("cv::Mat"); |
|
|
|
|
|
|
|
qRegisterMetaType<QVector<double>>("QVector<double>"); |
|
|
|
|
|
|
|
|
|
|
|
usb = new usbthread(); |
|
|
|
usb = new usbthread(); |
|
|
|
ucontrol = new usbcontrol(); |
|
|
|
ucontrol = new usbcontrol(); |
|
|
@ -775,15 +806,3 @@ void MainWindow::on_spinBox_2_valueChanged(int arg1) |
|
|
|
ui->label->resize(cols,rows); |
|
|
|
ui->label->resize(cols,rows); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_4_clicked() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
saveeeee = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_5_clicked() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|