备份
This commit is contained in:
Binary file not shown.
@@ -16,7 +16,7 @@ bool pinHalconEvaluate(std::shared_ptr <detData> data, cv::Rect& Result, cv::Mat
|
||||
std::vector<handdleAI::Bbox> pinDetEvaluate(std::shared_ptr <detData> data, cv::Mat& src, handleAiModelManager* _handleAiModelManager)
|
||||
{
|
||||
std::vector<handdleAI::Bbox> result;
|
||||
handleAiModelDet* detPtr = _handleAiModelManager->getDetModel(data->_productDataStruct.handleAiData.detModelName);
|
||||
handleAiModelDet* detPtr = _handleAiModelManager->getDetModel("connectorDet.BHD");
|
||||
if (detPtr == nullptr)
|
||||
return std::vector<handdleAI::Bbox>();
|
||||
detPtr->Evaluate(src, result);
|
||||
|
||||
@@ -23,6 +23,7 @@ bool processAlgo(std::shared_ptr <detData> data, handleAiModelManager* _handleAi
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << "Caught exception: " << e.what() << std::endl;
|
||||
std::cout << "Caught exception: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -62,7 +62,7 @@ static void apexSmallHalconPaint(cv::Mat& out, std::vector<startAndEndPoints>xLi
|
||||
static cv::Mat apexSmallHalconAlgo(std::shared_ptr<detData>data, cv::Mat& src)
|
||||
{
|
||||
cv::Mat halconImg;
|
||||
src(cv::Rect(50, 50, src.cols - 100, src.rows - 150)).copyTo(halconImg);
|
||||
src.copyTo(halconImg);
|
||||
HTuple hv_out_OK_Pings;
|
||||
HTuple hv_out_NG_Pings;
|
||||
HTuple hv_out_Flag_INS;
|
||||
|
||||
@@ -706,6 +706,10 @@ struct rectAndData
|
||||
//平铺图像
|
||||
static cv::Mat tiledImages(std::vector<cv::Mat>& imgs)
|
||||
{
|
||||
if (imgs.size() == 0)
|
||||
return cv::imread("./noimg.png",-1);
|
||||
if (imgs.size() == 1)
|
||||
return imgs[0];
|
||||
//总图像大小 平铺显示
|
||||
int matWidth = 0, matHeight = 0;
|
||||
for (auto& mat : imgs)
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
std::vector<std::string>imgSaveFileParameter;//命名规则 str1_str2... 第一个参数已默认为相机名,在构造函数
|
||||
|
||||
//需要存入的SQL数据
|
||||
std::vector<std::pair<std::string, double>> sqlVec;
|
||||
std::vector<std::pair<std::string, std::string>> sqlVec;
|
||||
detData(std::string IN_cameraKeyName)
|
||||
{
|
||||
cameraKeyName = IN_cameraKeyName;
|
||||
|
||||
@@ -259,6 +259,8 @@ public:
|
||||
//检测结果处理
|
||||
void detectionResultHandle(std::shared_ptr<detData>data)
|
||||
{
|
||||
data->sqlVec.push_back({ "SN",data->SNcode });
|
||||
data->sqlVec.push_back({ "ARMPOS",std::to_string(data->armPos)});
|
||||
//发送图片
|
||||
if (data->resultImgs.size() > 0)
|
||||
{
|
||||
@@ -292,25 +294,26 @@ public:
|
||||
emit _core._qtFunc.addDashBoardData(1, data->aiDetOK);
|
||||
emit _core._qtFunc.uiModuleLocationMap_SetProductSignStatus(data->armPos,
|
||||
(data->halconOK==true&& data->aiDetOK==true)?2:3);
|
||||
bool finalOk = (data->halconOK == true || data->aiDetOK == true)? true :false;
|
||||
if(finalOk=false)
|
||||
bool finalOk = (data->halconOK == true && data->aiDetOK == true);
|
||||
if(finalOk == false)
|
||||
{
|
||||
for (auto showMat : data->resultImgs)
|
||||
for (auto& showMat : data->resultImgs)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
cvMatToQPixMap(showMat, pixmap);
|
||||
showImgPack* pack = new showImgPack();
|
||||
//showImgPack* pack = new showImgPack();
|
||||
emit _core._qtFunc.uiModuleImageDoubleCheckQdialog_ShowWindows(pixmap);
|
||||
}
|
||||
}
|
||||
auto productData = _core._productDataCache.get(currentSn);
|
||||
if (finalOk = false)
|
||||
if (finalOk == false)
|
||||
productData->ngCount++;
|
||||
perConnector _perConnectorData;
|
||||
_perConnectorData.aiOk = data->aiDetOK;
|
||||
_perConnectorData.halconOk = data->halconOK;
|
||||
_perConnectorData.maxPinDetValue = data->maxPinDetValue;
|
||||
productData->connectorResults.push_back(_perConnectorData);
|
||||
data->sqlVec.push_back({ "Result",std::to_string(finalOk)});
|
||||
}
|
||||
//ct计算以及发送到界面
|
||||
auto totalCt = std::chrono::duration_cast<std::chrono::milliseconds>(data->halconEndTime - data->algoStartTime);
|
||||
@@ -322,11 +325,13 @@ public:
|
||||
emit _core._qtFunc.addCtData(1, aiCt.count());
|
||||
if (halconCt.count() > 0)
|
||||
emit _core._qtFunc.addCtData(2, halconCt.count());
|
||||
|
||||
data->sqlVec.push_back({ "totalCt",std::to_string(totalCt.count()) });
|
||||
data->sqlVec.push_back({ "aiCt",std::to_string(aiCt.count()) });
|
||||
data->sqlVec.push_back({ "halconCt",std::to_string(halconCt.count()) });
|
||||
//SQL
|
||||
std::vector<sqlData> sqlDatas;
|
||||
for (auto sqlData : data->sqlVec)
|
||||
sqlDatas.push_back({ sqlData.first, std::to_string(sqlData.second) });
|
||||
sqlDatas.push_back({ sqlData.first, sqlData.second });
|
||||
_core._appConfig._sqlManager.addData(data->SNcode, sqlDatas);
|
||||
|
||||
//写入plc
|
||||
@@ -364,5 +369,10 @@ public slots:
|
||||
_triggerManager.sendFinsMsg("write_short_350_" + QString::number(_core._appConfig.productDatas[productTypeIn].indexOfArm));
|
||||
_triggerManager.sendFinsMsg("write_short_351_1");
|
||||
}
|
||||
//人工复盘按下NG
|
||||
void uiModuleImageDoubleCheckQdialog_pressNG()
|
||||
{
|
||||
_triggerManager.sendFinsMsg("write_short_363_1");
|
||||
}
|
||||
};
|
||||
#pragma once
|
||||
@@ -107,8 +107,12 @@ void connectSignalAndSlots(MainWindow* front, appCore* _core, detProcess* _detPr
|
||||
front->_displayWidget->_uiModuleLocationMap, &uiModuleLocationMap::resetToDefault);
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleLocationMap_SetProductSignStatus,
|
||||
front, &MainWindow::uiModuleLocationMapSetProductSignStatus);
|
||||
//uiModuleImageDoubleCheckQdialog
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleImageDoubleCheckQdialog_ShowWindows,
|
||||
front, [=](QPixmap map) {front->_imageDoubleCheckQdialog->showAndSetImg(map); });
|
||||
QObject::connect(front->_imageDoubleCheckQdialog,&imageDoubleCheckQdialog::ngSignal,
|
||||
_detProcess, &detProcess::uiModuleImageDoubleCheckQdialog_pressNG);
|
||||
//uiModuleSummaryDataManager
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleSummaryDataManager_SetSummaryResultText,
|
||||
front, [=](QString text, Qt::GlobalColor color)
|
||||
{front->_displayWidget->_summaryDataManager->setSummaryResult(text, color); });
|
||||
|
||||
@@ -17,6 +17,8 @@ public:
|
||||
QPushButton* closeBtn = new QPushButton(this);
|
||||
fancyButtonText* okBtn = new fancyButtonText(120, 40, "OK", "继续");
|
||||
fancyButtonText* ngBtn = new fancyButtonText(120, 40, "NG", "继续");
|
||||
QMutex mutex;
|
||||
QQueue< QPixmap>imgqueue;
|
||||
imageDoubleCheckQdialog()
|
||||
{
|
||||
QPalette paletteWhite, paletteRed, paletteGreen;
|
||||
@@ -81,21 +83,21 @@ public:
|
||||
menuBarLayoutRight->addWidget(closeBtn);
|
||||
|
||||
QObject::connect(closeBtn, &QPushButton::clicked, this, &QDialog::close);
|
||||
|
||||
|
||||
QHBoxLayout* imageViewLayout = new QHBoxLayout();
|
||||
imageViewLayout->addWidget(_ImageWidgetManager);
|
||||
|
||||
_ImageWidgetManager->createViewer("");
|
||||
_ImageWidgetManager->disableAllSwitchBtn();
|
||||
|
||||
|
||||
QHBoxLayout* okngBtnLayout = new QHBoxLayout();
|
||||
okngBtnLayout->addWidget(okBtn);
|
||||
okngBtnLayout->addWidget(ngBtn);
|
||||
|
||||
QObject::connect(okBtn, &QPushButton::clicked, this, &QDialog::close);
|
||||
QObject::connect(ngBtn, &QPushButton::clicked, this, &QDialog::close);
|
||||
QObject::connect(okBtn, &QPushButton::clicked, this, [=]() {emit okSignal(); });
|
||||
QObject::connect(ngBtn, &QPushButton::clicked, this, [=]() {emit ngSignal(); });
|
||||
//QObject::connect(okBtn, &QPushButton::clicked, this, &QDialog::close);
|
||||
//QObject::connect(ngBtn, &QPushButton::clicked, this, &QDialog::close);
|
||||
QObject::connect(okBtn, &QPushButton::clicked, this, [=]() {pressOK(); });
|
||||
QObject::connect(ngBtn, &QPushButton::clicked, this, [=]() {pressNG(); });
|
||||
|
||||
layout->addWidget(menuBarWidget, 0, 0);
|
||||
layout->addLayout(imageViewLayout, 1, 0);
|
||||
@@ -105,13 +107,57 @@ public:
|
||||
}
|
||||
void showAndSetImg(QPixmap img)
|
||||
{
|
||||
_ImageWidgetManager->showImg(img, imgWidgetShowType::imgWidgetOri, 0);
|
||||
this->show();
|
||||
mutex.lock();
|
||||
std::cout << isShowing<<"-" << imgqueue.size()<< std::endl;
|
||||
if (isShowing == false && imgqueue.size() == 0)
|
||||
{
|
||||
_ImageWidgetManager->showImg(img, imgWidgetShowType::imgWidgetOri, 0);
|
||||
this->show();
|
||||
isShowing = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
imgqueue.enqueue(img);
|
||||
}
|
||||
mutex.unlock();
|
||||
}
|
||||
signals:
|
||||
void okSignal();
|
||||
void ngSignal();
|
||||
private:
|
||||
void pressOK()
|
||||
{
|
||||
mutex.lock();
|
||||
emit okSignal();
|
||||
if (imgqueue.size() > 0)
|
||||
{
|
||||
QPixmap img = imgqueue.dequeue();
|
||||
_ImageWidgetManager->showImg(img, imgWidgetShowType::imgWidgetOri, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowing = false;
|
||||
close();
|
||||
}
|
||||
mutex.unlock();
|
||||
}
|
||||
void pressNG()
|
||||
{
|
||||
mutex.lock();
|
||||
emit ngSignal();
|
||||
if (imgqueue.size() > 0)
|
||||
{
|
||||
QPixmap img = imgqueue.dequeue();
|
||||
_ImageWidgetManager->showImg(img, imgWidgetShowType::imgWidgetOri, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowing = false;
|
||||
close();
|
||||
}
|
||||
mutex.unlock();
|
||||
}
|
||||
bool isShowing = false;
|
||||
bool isMoving = false;
|
||||
bool isResizing = false;
|
||||
int minWidth = 720, minHeight = 480;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user