diff --git a/3part/tadpole/include/tpBase/lpbengine.h b/3part/tadpole/include/tpBase/lpbengine.h index eb4ea8e..1fe81af 100644 Binary files a/3part/tadpole/include/tpBase/lpbengine.h and b/3part/tadpole/include/tpBase/lpbengine.h differ diff --git a/src/lpbdesigner/DsgAlgoDlg.cpp b/src/lpbdesigner/DsgAlgoDlg.cpp index 5ca6734..678193d 100644 --- a/src/lpbdesigner/DsgAlgoDlg.cpp +++ b/src/lpbdesigner/DsgAlgoDlg.cpp @@ -15,6 +15,14 @@ CDsgAlgoDlg::CDsgAlgoDlg(QWidget *parent) : QDialog(parent), ui(new Ui::AlgoDlg) connect(ui->pushButton_4, SIGNAL(clicked()), this, SLOT(OnSelectAlgo())); } +CDsgAlgoDlg::~CDsgAlgoDlg() +{ + if (ui) { + delete ui; + ui = NULL; + } +} + bool CDsgAlgoDlg::Initialize(IDetectorEngine* lpDE, IDetectorTask* lpTask) { if (!lpDE || !lpTask) @@ -22,22 +30,12 @@ bool CDsgAlgoDlg::Initialize(IDetectorEngine* lpDE, IDetectorTask* lpTask) m_pDE = lpDE; m_pTask = lpTask; - - if (!InitGraphView()) - return false; - return true; -} - -bool CDsgAlgoDlg::InitGraphView() -{ - return true; } bool CDsgAlgoDlg::OnOk() { QDialog::accept(); - return true; } @@ -140,8 +138,3 @@ IDetectorAlgorithm* CDsgAlgoDlg::ShowAlgoDlg(IDetectorAlgorithm* pAlgo) } return pAlgo; } - -void CDsgAlgoDlg::CleanUp() -{ - -} \ No newline at end of file diff --git a/src/lpbdesigner/DsgAlgoDlg.h b/src/lpbdesigner/DsgAlgoDlg.h index d33400f..b561fbb 100644 --- a/src/lpbdesigner/DsgAlgoDlg.h +++ b/src/lpbdesigner/DsgAlgoDlg.h @@ -15,19 +15,9 @@ class CDsgAlgoDlg : public QDialog Q_OBJECT public: CDsgAlgoDlg(QWidget *parent = 0); - ~CDsgAlgoDlg(){ - if (ui){ - delete ui; - ui = NULL; - } - } + ~CDsgAlgoDlg(); bool Initialize(IDetectorEngine* lpDE, IDetectorTask* lpTask); IDetectorAlgorithm* ShowAlgoDlg(IDetectorAlgorithm* pAlgo); - bool InitGraphView(); - void CleanUp(); - -signals: - public slots : bool OnOk(); bool OnCancel(); diff --git a/src/lpbdesigner/DsgParamDlg.cpp b/src/lpbdesigner/DsgParamDlg.cpp index e1f82d9..1aecb2e 100644 --- a/src/lpbdesigner/DsgParamDlg.cpp +++ b/src/lpbdesigner/DsgParamDlg.cpp @@ -19,12 +19,8 @@ CDsgParamDlg::CDsgParamDlg(QWidget *parent) : QDialog(parent), m_valueCombox(thi connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeParamType())); connect(ui->comboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeAlgo())); - connect(ui->m_pbROISet, SIGNAL(clicked()), this, SLOT(OnShowRoiDlg())); - //Qt::WindowFlags flags = Qt::Dialog; - //flags |= Qt::WindowMinMaxButtonsHint; - //flags |= Qt::WindowCloseButtonHint; - //setWindowFlags(flags); + } CDsgParamDlg::~CDsgParamDlg() @@ -167,6 +163,7 @@ PLP_ALGORITHM_PARAM CDsgParamDlg::ShowParamDlg(PLP_ALGORITHM_PARAM pParam) ui->checkBox->setChecked(pParam->bIsSave); ui->checkBox_2->setChecked(pParam->bIsLock); + ui->checkBox_3->setChecked(pParam->bIsShow); int srcParmID = ui->comboBox_3->findData(pParam->nSrcParamID); ui->comboBox_3->setCurrentIndex(srcParmID > 0 ? srcParmID : 0); @@ -185,7 +182,7 @@ PLP_ALGORITHM_PARAM CDsgParamDlg::ShowParamDlg(PLP_ALGORITHM_PARAM pParam) m_valueCombox.clear(); ui->checkBox->setChecked(false); ui->checkBox_2->setChecked(false); - + ui->checkBox_3->setChecked(false); m_tRoiData.img.release(); m_tRoiData.records.clear(); } @@ -204,10 +201,9 @@ PLP_ALGORITHM_PARAM CDsgParamDlg::ShowParamDlg(PLP_ALGORITHM_PARAM pParam) tParam.strDescription = ui->lineEdit_3->text(); tParam.bIsSave = ui->checkBox->isChecked(); tParam.bIsLock = ui->checkBox_2->isChecked(); + tParam.bIsShow = ui->checkBox_3->isChecked(); - - if (pParam) - { + if (pParam) { pParam->strName = tParam.strName; pParam->type = tParam.type; pParam->nSrcAlgoID = tParam.nSrcAlgoID; @@ -216,6 +212,7 @@ PLP_ALGORITHM_PARAM CDsgParamDlg::ShowParamDlg(PLP_ALGORITHM_PARAM pParam) pParam->strDescription = tParam.strDescription; pParam->bIsSave = tParam.bIsSave; pParam->bIsLock = tParam.bIsLock; + pParam->bIsShow = tParam.bIsShow; return pParam; } @@ -225,11 +222,9 @@ PLP_ALGORITHM_PARAM CDsgParamDlg::ShowParamDlg(PLP_ALGORITHM_PARAM pParam) else if (m_type == PARAM_OUT) pNewParam = m_pAlgo->AddOutParam(&tParam); - if (pNewParam) - { + if (pNewParam) { return pNewParam; } - } return NULL; @@ -328,11 +323,6 @@ int CDsgParamDlg::GetTypeIndex(AlgoParamType type) return nIndex; } -void CDsgParamDlg::CleanUp() -{ - -} - void CDsgParamDlg::InitValueCtrl(AlgoParamType type, PLP_ALGORITHM_PARAM pParam) { switch (type) diff --git a/src/lpbdesigner/DsgParamDlg.h b/src/lpbdesigner/DsgParamDlg.h index bd6ea7c..db13c92 100644 --- a/src/lpbdesigner/DsgParamDlg.h +++ b/src/lpbdesigner/DsgParamDlg.h @@ -27,16 +27,11 @@ public: ~CDsgParamDlg(); bool Initialize(IDetectorEngine* lpDE, IDetectorTask* lpTask, IDetectorAlgorithm* lpAlgo, ParamDialogType type); bool InitGraphView(); - void CleanUp(); PLP_ALGORITHM_PARAM ShowParamDlg(PLP_ALGORITHM_PARAM pParam); - int GetTypeIndex(AlgoParamType type); void InitValueCtrl(AlgoParamType type, PLP_ALGORITHM_PARAM pParam); QVariant GetCtrlValue(AlgoParamType type); - -signals: - - public slots : +public slots : bool OnOk(); bool OnCancel(); bool OnChangeParamType(); @@ -50,11 +45,8 @@ private: IDetectorEngine* m_pDE{ nullptr }; IDetectorTask* m_pTask{ nullptr }; IDetectorAlgorithm* m_pAlgo{ nullptr }; - ParamDialogType m_type; - LP_DETECTOR_ROI_DATA m_tRoiData; - AlgoParamType _ParamType{ LP_INT }; }; diff --git a/src/lpbdesigner/MainFrame.cpp b/src/lpbdesigner/MainFrame.cpp index 6c0200e..f6ea448 100644 --- a/src/lpbdesigner/MainFrame.cpp +++ b/src/lpbdesigner/MainFrame.cpp @@ -127,22 +127,13 @@ CMainFrame::CMainFrame(QWidget *parent) ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->tableWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnParamListPopMenu(const QPoint&))); - connect(ui->tableWidget, SIGNAL(cellChanged(int, int)), this, SLOT(OnCellChanged(int, int))); connect(ui->tableWidget, SIGNAL(cellClicked(int, int)), this, SLOT(OnCellClicked(int, int))); -// connect(ui->listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(OnListItemClick())); -// connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(OnListItemDoubleClick())); - -// ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu); -// connect(ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnListWidgetPopMenu(const QPoint&))); - ui->gv_input->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->gv_input, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnGvInputWidgetPopMenu(const QPoint&))); - - connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(OnClearResult())); - connect(ui->m_pbLoadImage, SIGNAL(clicked()), this, SLOT(onLoadImage())); - //connect(ui->menubar, SIGNAL(triggered(QAction *)), this, SLOT(OnMainMenuTrigger(QAction*))); - connect(ui->m_pbSaveBtn, SIGNAL(clicked()), this, SLOT(OnTrigger())); + connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(OnClearResult()));//清空打印信息 + connect(ui->m_pbLoadImage, SIGNAL(clicked()), this, SLOT(onLoadImage()));//加载图片 + connect(ui->m_pbSaveBtn, SIGNAL(clicked()), this, SLOT(OnTrigger()));//保存标定参数 connect(this, SIGNAL(sgShowStatus(QString)), this, SLOT(OnShowStatus(QString))); ui->gv_input->setInfoLabel(ui->label_pixel_info); @@ -156,7 +147,6 @@ CMainFrame::CMainFrame(QWidget *parent) m_plablStatus = new QLabel(this); ui->statusBar->addWidget(m_plablStatus); _pSaveStatus = ui->label_SaveStatus; - } CMainFrame::~CMainFrame() @@ -257,9 +247,12 @@ bool CMainFrame::InitGraphView() ui->tableWidget_2->verticalHeader()->setHidden(true); ui->tableWidget_2->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents); - ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents); - ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents); - + ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Custom); + ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Custom); + ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch); + ui->tableWidget->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Stretch); + ui->tableWidget->hideColumn(2); + ui->tableWidget_2->hideColumn(2); ui->textEdit->setWordWrapMode(QTextOption::NoWrap); { /*获取所有的solution*/ @@ -364,6 +357,7 @@ bool CMainFrame::InitCurrentTask() ui->tableWidget_2->setItem(nIndex, 1, new QTableWidgetItem(QObject::tr(pAlg->GetAlgorithmInfo()->strName.toStdString().c_str()))); ui->tableWidget_2->setItem(nIndex, 2, new QTableWidgetItem(QString::number(pAlg->GetAlgorithmInfo()->nRoiID))); + ui->tableWidget_2->setItem(nIndex, 3, new QTableWidgetItem(pAlg->GetAlgorithmInfo()->strDescription)); if (nIndex == 0) { @@ -459,58 +453,6 @@ bool CMainFrame::OnSetRunSolution() return false; } -bool CMainFrame::OnBatchLoadImage(bool bReLoad) -{ - if (!currentTask()) - return false; - - QString strDefaultDirPath = m_pCurrentTask->GetTaskInfo()->strDirPath; - QStringList strFileNamesList = QFileDialog::getOpenFileNames(this, "open file", strDefaultDirPath, "Images (*.bmp *.png *.xpm *.jpg)"); - if (strFileNamesList.size() <= 0) - { - return false; - } - -// ui->listWidget->clear(); -// ui->listWidget->setSpacing(12); -// ui->listWidget->setMovement(QListView::Static); -// ui->listWidget->setViewMode(QListView::IconMode); -// ui->listWidget->setWrapping(false); -// ui->listWidget->setFlow(QListView::LeftToRight); - -// for (int i = 0; i < strFileNamesList.size(); i++) -// { -// QListWidgetItem* item = new QListWidgetItem("Test", ui->listWidget); -// item->setData(Qt::UserRole, strFileNamesList.at(i)); -// item->setText(strFileNamesList.at(i).split("/").last()); -// ui->listWidget->addItem(item); -// } - - QString strFileName = strFileNamesList[0]; - std::string strpath = strFileName.toLocal8Bit().toStdString();//中文路径支持 - //cv::Mat m_img = cv::imread(strpath, CV_LOAD_IMAGE_UNCHANGED); - m_pCurrentTask->GetTaskInfo()->templateImg = cv::imread(strpath, CV_LOAD_IMAGE_GRAYSCALE); - oldMat = m_pCurrentTask->GetTaskInfo()->templateImg; - if (ColossusBase::showImage(m_pCurrentTask->GetTaskInfo()->templateImg, ui->gv_input)) - { - m_pCurrentTask->GetTaskInfo()->strImageName = strFileName.split("/").last(); - } - return true; -} - -bool CMainFrame::OnCopyFileTitle() -{ -// QListWidgetItem* item = ui->listWidget->currentItem(); - -// if (item) -// { -// QClipboard *clipboard = QApplication::clipboard(); -// clipboard->setText(item->text()); -// } - - return true; -} - void CMainFrame::OnShowCameraImage(QImage img) { m_pCurrentTask->GetTaskInfo()->templateImg = ColossusBase::QImage2cvMat(img).clone(); @@ -527,20 +469,6 @@ void __stdcall ImageEventHandler(void * callBackOwner, QImage& img, int nDeviceI emit p->sgShowCameraImage(img); } -bool CMainFrame::OnSnapImage() -{ -// if (!currentTask()) -// return false; -// -// DeviceType type; -// IDetectorCameraDevice* pCamera = (IDetectorCameraDevice*)m_pDeviceMgr->GetDevice(m_pCurrentTask->GetTaskInfo()->nCameraID, type); -// if (!pCamera && type != CAMERA) -// return false; -// -// pCamera->SnapImage(this, ImageEventHandler); - return true; -} - bool CMainFrame::InitCurrentNode() { if (!m_pSolutionMgr) @@ -578,10 +506,8 @@ bool CMainFrame::InitCurrentNode() return false; } } - return true; } - return true; } @@ -589,42 +515,26 @@ bool CMainFrame::OnTreeItemClick() { if (!InitCurrentTask()) return false; - return true; } bool CMainFrame::OnParamPopMenu(const QPoint& points) { + if (!currentTask()) + return false; QMenu menu(this); QAction *runAction = menu.addAction(QObject::tr("运行")); runAction->setObjectName("runAction"); menu.addSeparator(); -// QAction *addAlgoAction = menu.addAction(QStringLiteral("添加算法")); -// addAlgoAction->setObjectName("addAlgoAction"); -// menu.addSeparator(); - - QAction *selectAlgoAction = menu.addAction(QObject::tr("选择算法")); - selectAlgoAction->setObjectName("selectAlgoAction"); - QAction *editAction = menu.addAction(QObject::tr("编辑")); - editAction->setObjectName("editAction"); -// QAction *deleteAction = menu.addAction(QStringLiteral("删除")); -// deleteAction->setObjectName("deleteAction"); -// menu.addSeparator(); - QAction *setAction = menu.addAction(QObject::tr("输入参数设置")); setAction->setObjectName("setAction"); QAction *outParamAction = menu.addAction(QObject::tr("输出参数设置")); outParamAction->setObjectName("outParamAction"); -// QAction *importParamAciton = menu.addAction(QStringLiteral("导入参数")); -// QAction *exportParamAciton = menu.addAction(QStringLiteral("导出参数")); -// QAction *importOutParamAciton = menu.addAction(QStringLiteral("导入输出参数")); -// QAction *exportOutParamAciton = menu.addAction(QStringLiteral("导出输出参数")); QAction *updateRelyOnAlgoAciton = menu.addAction(QObject::tr("更新关联算法参数")); updateRelyOnAlgoAciton->setObjectName("updateRelyOnAlgoAciton"); - QAction *selectedAction = menu.exec(QCursor::pos()); if (!selectedAction) { @@ -787,7 +697,6 @@ bool CMainFrame::OnDeleteAlgo() } } } - return false; } @@ -808,7 +717,6 @@ bool CMainFrame::OnSetAlgo() IDetectorAlgorithm* pAlgo = m_pCurrentTask->GetAlgorithm(nCurrentID); if (!pAlgo) return false; - //CDsgAlgorithmParamMgrDlg m_tParamMgrDlg; if (!m_tParamMgrDlg.Initialize(m_pDE, m_pCurrentTask, pAlgo,PARAM_IN)) return false; m_tParamMgrDlg.setParent(this); @@ -817,11 +725,8 @@ bool CMainFrame::OnSetAlgo() m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal); m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true); m_tParamMgrDlg.ShowParamMgrDlg(pAlgo); - //m_tParamMgrDlg.exec(); } - } - return true; } @@ -841,7 +746,6 @@ bool CMainFrame::OnSetOutParam() IDetectorAlgorithm* pAlgo = m_pCurrentTask->GetAlgorithm(nCurrentID); if (!pAlgo) return false; - //CDsgAlgorithmParamMgrDlg m_tParamMgrDlg; if (!m_tParamMgrDlg.Initialize(m_pDE, m_pCurrentTask, pAlgo,PARAM_OUT)) return false; @@ -851,10 +755,8 @@ bool CMainFrame::OnSetOutParam() m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal); m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true); m_tParamMgrDlg.ShowParamMgrDlg(pAlgo); - //m_tParamMgrDlg.exec(); } } - return true; } @@ -875,44 +777,32 @@ bool CMainFrame::OnRunAlgo() if (!pAlgo) return false; m_pCurrentTask->GetTaskInfo()->detectImg = m_pCurrentTask->GetTaskInfo()->templateImg; - //QString strHeader = ""; - //strHeader += ""; - //strHeader += pAlgo->GetAlgorithmInfo()->strName; - - //if (pCurrentTask->GetTaskInfo()->strImageName.size() > 0) - //{ - // strHeader += "->"; - // strHeader += pCurrentTask->GetTaskInfo()->strImageName; - //} - //strHeader += ":"; - //ui->textEdit->append(strHeader); - if (pAlgo->Exec()) { QString strResult = ""; - strResult += ""; + strResult += ""; strResult += QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"); strResult += " "; strResult += ""; - strResult += ""; + strResult += ""; strResult += QObject::tr("算法名称:"); strResult += ""; - strResult += ""; + strResult += ""; strResult += QObject::tr(pAlgo->GetAlgorithmInfo()->strName.toStdString().c_str()); strResult += ""; strResult += ","; if (m_pCurrentTask->GetTaskInfo()->strImageName.size() > 0) { - strResult += ""; + strResult += ""; strResult += QObject::tr("图片名称:"); strResult += ""; - strResult += ""; + strResult += ""; strResult += m_pCurrentTask->GetTaskInfo()->strImageName; strResult += ""; strResult += ","; @@ -924,11 +814,11 @@ bool CMainFrame::OnRunAlgo() PLP_ALGORITHM_PARAM pOutParam = *it; if (pOutParam) { - strResult += ""; + strResult += ""; strResult += pOutParam->strName + ":"; strResult += ""; - strResult += ""; + strResult += ""; switch (pOutParam->type) { case LP_INT: @@ -994,12 +884,11 @@ bool CMainFrame::OnRunAlgo() strResult = strResult.left(strResult.length() - 1); ui->textEdit->append(strResult); } - } else { QString strResult = ""; - strResult += ""; + strResult += ""; strResult += QObject::tr("加载算法失败,请检查是否配置相应的算法库"); strResult += ""; ui->textEdit->append(strResult); @@ -1070,27 +959,6 @@ bool CMainFrame::OnSelectAlgo() return true; } -bool CMainFrame::OnListWidgetPopMenu(const QPoint&) -{ - QMenu menu; - QAction *batchLoadImgAction = menu.addAction(QObject::tr("加载标定图片")); - //QAction *copyTitleAction = menu.addAction(QStringLiteral("复制图片名称")); - //QAction *deleteAction = menu.addAction(QStringLiteral("删除")); - - QAction *selectedAction = menu.exec(QCursor::pos()); - if (!selectedAction) - { - menu.clear(); - return false; - } - if (selectedAction == batchLoadImgAction) - { - OnBatchLoadImage(); - } - menu.clear(); - return true; -} - bool CMainFrame::OnGvInputWidgetPopMenu(const QPoint&) { if (!m_pCurrentTask || m_pCurrentTask->GetTaskInfo()->templateImg.empty()) @@ -1126,8 +994,6 @@ bool CMainFrame::OnGvInputWidgetPopMenu(const QPoint&) // return false; // } } - - menu.clear(); return true; } @@ -1137,35 +1003,11 @@ bool CMainFrame::OnListItemDoubleClick() return OnRunAlgo(); } -bool CMainFrame::OnListItemClick() -{ -// if (m_pCurrentTask) -// { -// QListWidgetItem* item = ui->listWidget->currentItem(); -// -// if (item) -// { -// QString strFilePath = item->data(Qt::UserRole).toString(); -// std::string strpath = strFilePath.toLocal8Bit().toStdString(); -// m_pCurrentTask->GetTaskInfo()->templateImg = cv::imread(strpath, 0); -// -// if (ColossusBase::showImage(m_pCurrentTask->GetTaskInfo()->templateImg, ui->gv_input)) -// { -// m_pCurrentTask->GetTaskInfo()->strImageName = strFilePath.split("/").last(); -// } -// } -// -// return true; -// } - return false; -} - void CMainFrame::OnClearResult() { ui->textEdit->clear(); } - bool CMainFrame::OnInitCurrentAlgoParam() { @@ -1204,13 +1046,16 @@ bool CMainFrame::OnInitCurrentAlgoParam() QMap mParam = m_pCurrentAlgo->GetAllParams(); int nIndex = 0; for (QMap::iterator its = mParam.begin(); its != mParam.end(); ++its){ + PLP_ALGORITHM_PARAM pParam = *its; + if(pParam->bIsShow == false) + continue; ui->tableWidget->setRowCount(nIndex + 1); ui->tableWidget->setItem(nIndex, 0, new QTableWidgetItem(QString::number(nIndex + 1))); ui->tableWidget->setItem(nIndex, 1, new QTableWidgetItem((*its)->strName)); ui->tableWidget->setItem(nIndex, 2, new QTableWidgetItem(GetParamTypeStr((*its)->type))); ui->tableWidget->setItem(nIndex, 3, new QTableWidgetItem(showVariant((*its)->type, (*its)->value))); - //ui->tableWidget->setItem(nIndex, 4, new QTableWidgetItem((*its)->strDescription)); + ui->tableWidget->setItem(nIndex, 4, new QTableWidgetItem((*its)->strDescription)); nIndex++; } } @@ -1222,38 +1067,27 @@ bool CMainFrame::OnInitCurrentAlgoParam() bool CMainFrame::OnParamListPopMenu(const QPoint&) { QMenu menu; -// QAction *addParamAction = menu.addAction(QStringLiteral("添加")); -// addParamAction->setObjectName("addParamAction"); QAction *editParamAction = menu.addAction(QObject::tr("编辑")); editParamAction->setObjectName("editParamAction"); -// QAction *deleteParamAction = menu.addAction(QStringLiteral("删除")); -// deleteParamAction->setObjectName("deleteParamAction"); - QAction *selectedAction = menu.exec(QCursor::pos()); - if (!selectedAction) { menu.clear(); return false; } QString strObj = selectedAction->objectName(); - - //if (selectedAction == addParamAction) if (strObj == "addParamAction") { OnAddParam(); } - //else if (selectedAction == editParamAction) else if (strObj == "editParamAction") { OnEditParam(); } - //else if (selectedAction == deleteParamAction) else if (strObj == "deleteParamAction") { OnDeleteParam(); } - menu.clear(); return true; } @@ -1274,15 +1108,12 @@ bool CMainFrame::OnAddParam() if (pParam) { int nRowCount = ui->tableWidget->rowCount(); - ui->tableWidget->setRowCount(nRowCount + 1); ui->tableWidget->setItem(nRowCount, 0, new QTableWidgetItem(QString::number(pParam->nID))); ui->tableWidget->setItem(nRowCount, 1, new QTableWidgetItem(pParam->strName)); ui->tableWidget->setItem(nRowCount, 2, new QTableWidgetItem(GetParamTypeStr(pParam->type))); ui->tableWidget->setItem(nRowCount, 3, new QTableWidgetItem(showVariant(pParam->type, pParam->value))); - ui->tableWidget->setItem(nRowCount, 4, new QTableWidgetItem(pParam->strDescription)); - return true; } @@ -1320,7 +1151,7 @@ bool CMainFrame::OnEditParam() int nRowIndex = ui->tableWidget->currentRow(); if (nRowIndex != -1) { - QListitems;//= ui->tableWidget->selectedItems(); + QList items; for (int i = 0; i < ui->tableWidget->colorCount(); i++) { items.push_back(ui->tableWidget->item(nRowIndex, i)); @@ -1333,29 +1164,20 @@ bool CMainFrame::OnEditParam() if (!oldMat.empty()) _pOldTask->GetTaskInfo()->templateImg = oldMat; } - //int nCurrentID = item->text().toInt(); QString strParaName = item->text(); AlgoParamType type; PLP_ALGORITHM_PARAM pParam = NULL; pParam = m_pCurrentAlgo->GetParamByName(strParaName); - //pParam = m_pCurrentAlgo->GetParam(nCurrentID); - if (pParam) { if (!m_tParamDlg.InitGraphView()) return false; - -// m_tParamDlg.show(); m_tParamDlg.setParent(this); m_tParamDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); m_tParamDlg.setWindowIcon(QIcon(":/image/leaper")); m_tParamDlg.setWindowModality(Qt::ApplicationModal); m_tParamDlg.setAttribute(Qt::WA_ShowModal, true); m_tParamDlg.ShowParamDlg(pParam); -// items.at(1)->setText(pParam->strName); -// items.at(2)->setText(GetParamTypeStr(pParam->type)); -// items.at(3)->setText(showVariant(pParam->type,pParam->value)); - //items.at(4)->setText(pParam->strDescription); QString st = _pOldTask->GetTaskInfo()->strName; if (!m_TaskChangeList.contains(st)) { @@ -1610,23 +1432,8 @@ QString CMainFrame::GetParamTypeStr(AlgoParamType type) return strType; } -void CMainFrame::OnCellChanged(int row, int column) -{ - QString str = sender()->objectName(); - int a = 1; -} - bool CMainFrame::OnNextBtnClick() { -// int index = ui->listWidget->currentRow(); -// int maxindex = ui->listWidget->count()-1; -// -// if (index < maxindex) -// { -// ui->listWidget->setCurrentRow(index + 1); -// OnListItemClick(); -// } - return OnRunAlgo(); } @@ -1657,30 +1464,24 @@ void CMainFrame::OnCellClicked(int row, int column) IDetectorSolution * CMainFrame::currentSolution() { if (!m_pCurrentSolution) { - //emit sgShowStatus("current solution not exist"); return NULL; } - //emit sgShowStatus("current solution exist"); return m_pCurrentSolution; } IDetectorTask * CMainFrame::currentTask() { if (!m_pCurrentTask) { - //emit sgShowStatus("current task not exist"); return NULL; } - //emit sgShowStatus("current task exist"); return m_pCurrentTask; } IDetectorAlgorithm * CMainFrame::currentAlgorithm() { if (!m_pCurrentAlgo) { - //emit sgShowStatus("current algo not exist"); return NULL; } - //emit sgShowStatus("current algo exist"); return m_pCurrentAlgo; } @@ -1690,38 +1491,6 @@ void CMainFrame::OnShowStatus(QString strMess) p->showMessage(strMess); } -QString CMainFrame::genInfo() -{ - //GetTaskInfo()->templateImg = oldMat; - } - if (SystemStateInfo::bParamStateFlag) - { - QMessageBox msgBox(QMessageBox::Warning, QObject::tr("提示"), QObject::tr("配置已修改过,是否保存相关参数到文件中?"), 0, this); - msgBox.addButton(QObject::tr("是"), QMessageBox::AcceptRole); - msgBox.addButton(QObject::tr("否"), QMessageBox::RejectRole); - if (msgBox.exec() == QMessageBox::AcceptRole) - { - //m_pDE->Save(); - } - SystemStateInfo::bParamStateFlag = false; - } - if (m_pSolutionMgr && m_pSolutionMgr->GetRunSolution()) { - m_pSolutionMgr->SetRunSolution(m_pSolutionMgr->GetRunSolution()->GetSolutionName()); - } - //OnManualTrigger(); - QMainWindow::closeEvent(event); -} - Q_SLOT void CMainFrame::onLoadImage() { if (!currentTask()) @@ -1743,3 +1512,4 @@ Q_SLOT void CMainFrame::onLoadImage() m_pCurrentTask->GetTaskInfo()->strImageName = strFileName.split("/").last(); } } + diff --git a/src/lpbdesigner/MainFrame.h b/src/lpbdesigner/MainFrame.h index 8845d95..6d1ae1f 100644 --- a/src/lpbdesigner/MainFrame.h +++ b/src/lpbdesigner/MainFrame.h @@ -9,7 +9,6 @@ #include "DsgParamDlg.h" #include "DsgAlgorithmParamMgr.h" #include "DsgAlgoDlg.h" -//#include "QParamDlg.h" namespace Ui { class MainFrame; @@ -39,9 +38,6 @@ public: IDetectorTask * currentTask(); IDetectorAlgorithm * currentAlgorithm(); - QString genInfo(); - - virtual void closeEvent(QCloseEvent *event); Q_SLOT void onLoadImage(); QString GetParamTypeStr(AlgoParamType type); signals: @@ -49,12 +45,7 @@ signals: void sgShowCameraImage(QImage); public slots: void OnShowStatus(QString); - bool OnTreeItemClick(); - bool OnBatchLoadImage(bool bReLoad = true); - bool OnCopyFileTitle(); - bool OnSnapImage(); - bool OnParamPopMenu(const QPoint&); bool OnAddAlgo(); bool OnEditAlgo(); @@ -64,9 +55,7 @@ public slots: bool OnRunAlgo(); bool OnSelectAlgo(); - bool OnListWidgetPopMenu(const QPoint&); bool OnGvInputWidgetPopMenu(const QPoint&); - bool OnListItemClick(); bool OnListItemDoubleClick(); void OnClearResult(); @@ -85,15 +74,10 @@ public slots: bool OnUpdateRelyOnAlgo(); bool OnParamListPopMenu(const QPoint&); - bool OnSetRunSolution(); - void OnCellChanged(int row, int column); void OnCellClicked(int row, int column); - bool OnNextBtnClick(); - - void OnShowCameraImage(QImage img); private: Ui::MainFrame *ui{ nullptr }; diff --git a/src/lpbdesigner/MainFrame.ui b/src/lpbdesigner/MainFrame.ui index 37cf09c..4d4149f 100644 --- a/src/lpbdesigner/MainFrame.ui +++ b/src/lpbdesigner/MainFrame.ui @@ -96,7 +96,7 @@ 9 - + 3 @@ -375,6 +375,11 @@ ROI + + + 描述 + + @@ -431,6 +436,11 @@ + + + 描述 + + @@ -466,11 +476,6 @@ QGraphicsView
lpimgviewer.h
- - LpTreeWidget - QTreeWidget -
lpTreeWidget.h
-
diff --git a/src/lpbdesigner/ParamDlg.ui b/src/lpbdesigner/ParamDlg.ui index 3a59be0..75d1e27 100644 --- a/src/lpbdesigner/ParamDlg.ui +++ b/src/lpbdesigner/ParamDlg.ui @@ -9,8 +9,8 @@ 0 0 - 343 - 334 + 377 + 360 @@ -24,189 +24,180 @@ 参数信息 - - - 9 - - - 9 - - - 9 - - - 9 + + + QLayout::SetFixedSize + + + + + Arial + + + + 名称: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + - - - - - - Arial - - - - 输出参数: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Arial - - - - - - - - - 0 - 30 - - - - - Arial - - - - - None - - - - - - - - - Arial - - - - 算法: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 30 - - - - - Arial - - - - - - - - - Arial - - - - 描述: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Arial - - - - - - - - - Arial - - - - 值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 30 - - - - - Arial - - - - - - - - - Arial - - - - 类型: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Arial - - - - - - - - - Arial - - - - 名称: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + Arial + + + + + + + + + Arial + + + + 类型: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 30 + + + + + Arial + + + + + + + + + Arial + + + + 值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + Arial + + + + + + + + + Arial + + + + 算法: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 30 + + + + + Arial + + + + + None + - + + + + + + + Arial + + + + 输出参数: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 30 + + + + + Arial + + + + + + + + + Arial + + + + 描述: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + Arial + + + + + + + @@ -218,7 +209,7 @@ - + @@ -230,39 +221,29 @@ - - - - - 0 - 0 - - - - - 0 - 30 - - - - - 1000 - 50 - - - - - Arial - - + + - 设置ROI + 是否显示 - + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -282,7 +263,7 @@ 0 - 30 + 50 @@ -300,7 +281,7 @@ 0 - 30 + 50 @@ -313,20 +294,50 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - - Qt::Vertical + + + + + 0 + 0 + - + - 20 - 40 + 0 + 50 - + + + 1000 + 50 + + + + + Arial + + + + 设置ROI + + diff --git a/src/lpbdesigner/lpTreeWidget.cpp b/src/lpbdesigner/lpTreeWidget.cpp deleted file mode 100644 index 125cb72..0000000 --- a/src/lpbdesigner/lpTreeWidget.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "lpTreeWidget.h" - -#include -#include -#include -#include -#include - -LpTreeWidget::LpTreeWidget(QWidget* parent /*= 0*/) -{ -// setDefaultDropAction(Qt::MoveAction); - //setDragDropMode(QAbstractItemView::DragDrop); -} - -void LpTreeWidget::dragEnterEvent(QDragEnterEvent * event) -{ - QTreeWidget::dragEnterEvent(event); -} - -void LpTreeWidget::dragLeaveEvent(QDragLeaveEvent * event) -{ - QTreeWidget::dragLeaveEvent(event); -} - -void LpTreeWidget::dragMoveEvent(QDragMoveEvent * event) -{ - QTreeWidget::dragMoveEvent(event); -} - -void LpTreeWidget::dropEvent(QDropEvent * event) -{ - QTreeWidgetItem* pItem = itemAt(event->pos()); - if (nullptr == pItem) - { - return; - } - else - { - emit sgDropEvent(event); - } - -// QTreeWidget::dropEvent(event); -} - -void LpTreeWidget::mousePressEvent(QMouseEvent * event) -{ - if (event->button() == Qt::LeftButton) - { - emit sgMousePressEvent(event); - } - - QTreeWidget::mousePressEvent(event); -} \ No newline at end of file diff --git a/src/lpbdesigner/lpTreeWidget.h b/src/lpbdesigner/lpTreeWidget.h deleted file mode 100644 index 60745f8..0000000 --- a/src/lpbdesigner/lpTreeWidget.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef LPTREEWIDGET_H -#define LPTREEWIDGET_H - -#include - -class LpTreeWidget :public QTreeWidget -{ - Q_OBJECT -public: - LpTreeWidget(QWidget *parent = 0); -signals: - void sgDropEvent(QDropEvent * event); - void sgMousePressEvent(QMouseEvent * event); - -protected: - void dragEnterEvent(QDragEnterEvent *e); - void dragLeaveEvent(QDragLeaveEvent * event); - void dragMoveEvent(QDragMoveEvent *e); - void dropEvent(QDropEvent *e); - void mousePressEvent(QMouseEvent * event); - -public: - -}; - -#endif // LPTREEWIDGET_H diff --git a/src/lpbengine/Algorithm.cpp b/src/lpbengine/Algorithm.cpp index cdb95c6..f778072 100644 --- a/src/lpbengine/Algorithm.cpp +++ b/src/lpbengine/Algorithm.cpp @@ -135,6 +135,7 @@ PLP_ALGORITHM_PARAM CDetectorAlgorithm::AddParam(const PLP_ALGORITHM_PARAM pPara p->strDescription = pParam->strDescription; p->bIsSave = pParam->bIsSave; p->bIsLock = pParam->bIsLock; + p->bIsShow = pParam->bIsShow; //m_vecParams.push_back(p); m_mapParams.insert(p->strName, p); @@ -153,6 +154,7 @@ PLP_ALGORITHM_PARAM CDetectorAlgorithm::AddParam(const PLP_ALGORITHM_PARAM pPara //(*its)->strDescription = pParam->strDescription; (*its)->bIsSave = pParam->bIsSave; (*its)->bIsLock = pParam->bIsLock; + (*its)->bIsShow = pParam->bIsShow; if (m_mapParams.contains(pParam->strName)) m_mapParams[pParam->strName] = (*its); return (*its); @@ -304,25 +306,6 @@ QMap CDetectorAlgorithm::GetAllOutParams() return m_vecOutParams; } -// int CDetectorAlgorithm::EnumOutParam(LP_ALGORITHM_PARAM** lppOutParam, int nCount) -// { -// if (!lppOutParam || nCount < m_vecOutParams.size()) -// return m_vecOutParams.size(); -// -// int nIndex = 0; -// for (QMap::iterator iter = m_vecOutParams.begin(); -// iter != m_vecOutParams.end(); ++iter) -// { -// if (NULL != *iter) -// { -// lppOutParam[nIndex] = *iter; -// nIndex++; -// } -// } -// -// return nIndex; -// } - bool CDetectorAlgorithm::SerializeParamPropertyToJson(QJsonObject* pJsonObject, QVariantMap& vProperty) { if (!pJsonObject) @@ -407,6 +390,7 @@ bool CDetectorAlgorithm::SerializeToJson(QJsonDocument* pJsonDocument, QJsonArra jsonParam.insert("param_name", p->strName); jsonParam.insert("param_type", p->type); jsonParam.insert("param_lock", p->bIsLock); + jsonParam.insert("param_show", p->bIsShow); switch (p->type) { case LP_INT: @@ -815,6 +799,7 @@ bool CDetectorAlgorithm::SerializeFromJson(QJsonObject* pJsonObject) param.strName = jsonObject.value("param_name").toString(); param.type = (AlgoParamType)jsonObject.value("param_type").toInt(); param.bIsLock = jsonObject.value("param_lock").toBool(); + param.bIsShow = jsonObject.value("param_show").toBool(true); switch (param.type) { case LP_INT: @@ -1399,7 +1384,6 @@ QList CDetectorAlgorithm::GetRelyOnAlgo() bool CDetectorAlgorithm::Exec() { - //quint64 msec = QDateTime::currentMSecsSinceEpoch(); int64 start = cv::getTickCount(); for (QMap::iterator iter = m_vecParams.begin(); iter != m_vecParams.end(); ++iter) @@ -1460,17 +1444,6 @@ bool CDetectorAlgorithm::ExecOnce() if (m_bIsFinished) return true; - //double start = (double)cv::getTickCount(); - //quint64 msec = QDateTime::currentMSecsSinceEpoch(); - //LARGE_INTEGER litmp; - //LONGLONG startTime, endTime; - //double dfMinus, dfFreq, dfTime; - - //QueryPerformanceFrequency(&litmp); - //dfFreq = (double)litmp.QuadPart; - - //QueryPerformanceCounter(&litmp); - //startTime = litmp.QuadPart; for (QMap::iterator iter = m_vecParams.begin(); iter != m_vecParams.end(); ++iter) { @@ -1491,7 +1464,6 @@ bool CDetectorAlgorithm::ExecOnce() } else return false; - } } } @@ -1650,6 +1622,7 @@ bool CDetectorAlgorithm::Copy(IDetectorAlgorithm* pSrcAlgo, bool bRet /* = true p->strDescription = pParam->strDescription; p->bIsSave = pParam->bIsSave; p->bIsLock = pParam->bIsLock; + p->bIsShow = pParam->bIsShow; m_vecParams[p->strName] = p; m_mapParams.insert(p->strName, p); @@ -1675,6 +1648,7 @@ bool CDetectorAlgorithm::Copy(IDetectorAlgorithm* pSrcAlgo, bool bRet /* = true p->strDescription = pOutParam->strDescription; p->bIsSave = pOutParam->bIsSave; p->bIsLock = pOutParam->bIsLock; + p->bIsShow = pOutParam->bIsShow; m_vecOutParams[p->strName] = p; m_mapOutParams.insert(p->strName, p); diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj b/tpvs17/lpdesigner/lpdesigner.vcxproj index 5e903c8..18fe121 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj @@ -147,16 +147,6 @@ $(QTDIR)\bin\moc.exe;%(FullPath) $(QTDIR)\bin\moc.exe;%(FullPath) - - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing lpTreeWidget.h... - .\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_CORE_LIB -DLPDESIGNER_LIB -D%(PreprocessorDefinitions) "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtWebkitWidgets" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\..\..\include\lpdesigner\algela" "-I.\..\..\include\lpdesigner" "-I.\..\..\src\lpbdesigner\GeneratedFiles" "-I.\..\..\src\ColossusBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\src\lpbdesigner" "-I.\..\..\3part\tadpole\include\tpBase" - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing lpTreeWidget.h... - .\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DLPDESIGNER_LIB -D%(PreprocessorDefinitions) "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtWebkitWidgets" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\..\..\include\lpdesigner\algela" "-I.\..\..\include\lpdesigner" "-I.\..\..\src\lpbdesigner\GeneratedFiles" "-I.\..\..\src\ColossusBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\src\lpbdesigner" "-I.\..\..\3part\tadpole\include\tpBase" - @@ -194,9 +184,6 @@ true - - true - true @@ -224,9 +211,6 @@ true - - true - true @@ -235,7 +219,6 @@ - diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters index a9a5280..541458c 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters @@ -93,9 +93,6 @@ Header Files - - Header Files - algela @@ -155,9 +152,6 @@ Source Files - - Source Files - Generated Files\Debug @@ -191,12 +185,6 @@ algela - - Generated Files - - - Generated Files - Source Files diff --git a/tpvs17/tpMain/lpMainWin.cpp b/tpvs17/tpMain/lpMainWin.cpp index 5cef0a7..8be3409 100644 --- a/tpvs17/tpMain/lpMainWin.cpp +++ b/tpvs17/tpMain/lpMainWin.cpp @@ -1812,6 +1812,7 @@ void lpMainWin::onUpdateByLevel(int nlevel) else ui.action_userManager->setVisible(false); } + Q_SLOT void lpMainWin::modWorkMgr(QString str) { m_pworkUI->modWorkMgr(str); diff --git a/tpvs17/valveDetector/modelVerfication.cpp b/tpvs17/valveDetector/modelVerfication.cpp index dc0e3c1..078b52d 100644 --- a/tpvs17/valveDetector/modelVerfication.cpp +++ b/tpvs17/valveDetector/modelVerfication.cpp @@ -96,9 +96,6 @@ bool modelVerfication::objectVerification(const Mat &img, Mat& baseImage, double s = result; return false; } - - - //Mat image = croppedImage / 255.0; } Mat modelVerfication::extractForegroundWheel(const Mat &background, const Mat &src) { @@ -113,8 +110,6 @@ Mat modelVerfication::extractForegroundWheel(const Mat &background, const Mat &s Mat modelVerfication::findWheelObject(Mat src, Mat backGroundImg, int thresh) { - - if (src.empty() || backGroundImg.empty() || src.cols < 500) { return Mat(); diff --git a/tpvs17/valveDetector/valveDetector.cpp b/tpvs17/valveDetector/valveDetector.cpp index 37f76f9..5b04b27 100644 --- a/tpvs17/valveDetector/valveDetector.cpp +++ b/tpvs17/valveDetector/valveDetector.cpp @@ -1341,7 +1341,7 @@ cv::Point2f ValveDetector::getCenter(Mat & imgSrc, Point2f pt, InputParam ¶m } return pt; } - +/* void ValveDetector::drawToImage(Mat &img, InputParam ¶mIn, OutputParam ¶mOut) { if (img.empty()) @@ -1396,5 +1396,5 @@ void ValveDetector::drawToImage(Mat &img, InputParam ¶mIn, OutputParam ¶ } cv::circle(img, paramIn.ptCenter, 3, LP_COLOR_BLUE, 2); } +*/ -//void ValveDetector::drawAngle() diff --git a/tpvs17/valveDetector/valveDetector.h b/tpvs17/valveDetector/valveDetector.h index dcb2eb5..7b65a63 100644 --- a/tpvs17/valveDetector/valveDetector.h +++ b/tpvs17/valveDetector/valveDetector.h @@ -5,7 +5,6 @@ #include "lpbengine.h" #define ALG_RESIZE_IMAGE_WIDTH 416.0 -//#define VEIW_HISTGRAM using namespace luffy_base; struct InputParam @@ -23,7 +22,6 @@ struct InputParam int nCenterAlg; // У׼㷨 int nBarScore; Mat barTemplate; // - //int bgThresh; int withinOffset; int barNum; // Mat centerRoi; @@ -66,9 +64,7 @@ public: double ruleData(double, int); QString genResultTip(QString str, int nType); Point2f getCenterPoints(Mat &_img, const Mat ¢erTempl, InputParam paramIn, Point2f pt, Mat& rstMat); - //bool saveResult(Mat &img, InputParam ¶mIn, OutputParam ¶mOut, QString modelStr); bool isValid(Mat target, Mat templ, Point2f pt, int validThresh); - void drawToImage(Mat &img, InputParam ¶mIn, OutputParam ¶mOut); cv::Mat findCircleObject(const Mat &src, const Mat& backgroundImg, int nThres = 20, luffy_base::luffyCircle *pCircle = NULL); cv::Mat getForeImage(const Mat & src, const Mat &backgroundImg); };