删除不需要的代码逻辑,调整designer模块中数据展示逻辑和UI

新增算法参数是否展示功能,供可配置
master
bob.pan 5 years ago
parent b579c05c38
commit d77755f952

@ -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()
{
}

@ -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();

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

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

@ -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 += "<span style='font-size:15px;color:#ff0000;font-weight:bold;'>";
//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 += "<span style='font-size:10px;font-weight:bold;'>";
strResult += "<span style='font-size:12px;font-weight:bold;'>";
strResult += QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss");
strResult += " ";
strResult += "</span>";
strResult += "<span style='font-size:10px;font-weight:bold;'>";
strResult += "<span style='font-size:12px;font-weight:bold;'>";
strResult += QObject::tr("算法名称:");
strResult += "</span>";
strResult += "<span style='font-size:10px;color:#ff0000;'>";
strResult += "<span style='font-size:12px;color:#ff0000;'>";
strResult += QObject::tr(pAlgo->GetAlgorithmInfo()->strName.toStdString().c_str());
strResult += "</span>";
strResult += ",";
if (m_pCurrentTask->GetTaskInfo()->strImageName.size() > 0)
{
strResult += "<span style='font-size:10px;font-weight:bold;'>";
strResult += "<span style='font-size:12px;font-weight:bold;'>";
strResult += QObject::tr("图片名称:");
strResult += "</span>";
strResult += "<span style='font-size:10px;color:#ff0000;'>";
strResult += "<span style='font-size:12px;color:#ff0000;'>";
strResult += m_pCurrentTask->GetTaskInfo()->strImageName;
strResult += "</span>";
strResult += ",";
@ -924,11 +814,11 @@ bool CMainFrame::OnRunAlgo()
PLP_ALGORITHM_PARAM pOutParam = *it;
if (pOutParam)
{
strResult += "<span style='font-size:10px;font-weight:bold;'>";
strResult += "<span style='font-size:12px;font-weight:bold;'>";
strResult += pOutParam->strName + ":";
strResult += "</span>";
strResult += "<span style='font-size:10px;color:#ff0000;'>";
strResult += "<span style='font-size:12px;color:#ff0000;'>";
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 += "<span style='font-size:10px;color:#ff0000;'>";
strResult += "<span style='font-size:12px;color:#ff0000;'>";
strResult += QObject::tr("加载算法失败,请检查是否配置相应的算法库");
strResult += "</span>";
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<QString, PLP_ALGORITHM_PARAM> mParam = m_pCurrentAlgo->GetAllParams();
int nIndex = 0;
for (QMap<QString, PLP_ALGORITHM_PARAM>::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)
{
QList<QTableWidgetItem*>items;//= ui->tableWidget->selectedItems();
QList<QTableWidgetItem*> 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()
{
//<! solution xx:, task xx:, algo: xx;
QString strMess = "";
return true;
}
void CMainFrame::closeEvent(QCloseEvent *event)
{
return QMainWindow::closeEvent(event);;
if (_pOldTask){
if (!oldMat.empty())
_pOldTask->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();
}
}

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

@ -96,7 +96,7 @@
<property name="handleWidth">
<number>9</number>
</property>
<widget class="LpTreeWidget" name="treeWidget">
<widget class="QTreeWidget" name="treeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>3</horstretch>
@ -375,6 +375,11 @@
<string>ROI</string>
</property>
</column>
<column>
<property name="text">
<string>描述</string>
</property>
</column>
</widget>
</item>
</layout>
@ -431,6 +436,11 @@
<string>值</string>
</property>
</column>
<column>
<property name="text">
<string>描述</string>
</property>
</column>
</widget>
</item>
</layout>
@ -466,11 +476,6 @@
<extends>QGraphicsView</extends>
<header>lpimgviewer.h</header>
</customwidget>
<customwidget>
<class>LpTreeWidget</class>
<extends>QTreeWidget</extends>
<header>lpTreeWidget.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="image.qrc"/>

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>343</width>
<height>334</height>
<width>377</width>
<height>360</height>
</rect>
</property>
<property name="font">
@ -24,189 +24,180 @@
<property name="windowTitle">
<string>参数信息</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" rowstretch="100,1,0">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>名称:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>输出参数:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>算法:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBox_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>描述:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_3">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>值:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>类型:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>名称:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>类型:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>值:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>算法:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item row="7" column="0">
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>输出参数:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBox_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>描述:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_3">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="font">
<font>
@ -218,7 +209,7 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="font">
<font>
@ -230,39 +221,29 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="m_pbROISet">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>50</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>设置ROI</string>
<string>是否显示</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<item row="8" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
@ -282,7 +263,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
<height>50</height>
</size>
</property>
<property name="font">
@ -300,7 +281,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
<height>50</height>
</size>
</property>
<property name="font">
@ -313,20 +294,50 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="m_pbROISet">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<property name="minimumSize">
<size>
<width>20</width>
<height>40</height>
<width>0</width>
<height>50</height>
</size>
</property>
</spacer>
<property name="maximumSize">
<size>
<width>1000</width>
<height>50</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>设置ROI</string>
</property>
</widget>
</item>
</layout>
</widget>

@ -1,53 +0,0 @@
#include "lpTreeWidget.h"
#include <QDragEnterEvent>
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QMouseEvent>
#include <QApplication>
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);
}

@ -1,26 +0,0 @@
#ifndef LPTREEWIDGET_H
#define LPTREEWIDGET_H
#include <QTreeWidget>
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

@ -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<QString, PLP_ALGORITHM_PARAM> 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<QString, PLP_ALGORITHM_PARAM>::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<int> CDetectorAlgorithm::GetRelyOnAlgo()
bool CDetectorAlgorithm::Exec()
{
//quint64 msec = QDateTime::currentMSecsSinceEpoch();
int64 start = cv::getTickCount();
for (QMap<QString, PLP_ALGORITHM_PARAM>::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<QString, PLP_ALGORITHM_PARAM>::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);

@ -147,16 +147,6 @@
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
</CustomBuild>
<CustomBuild Include="..\..\src\lpbdesigner\lpTreeWidget.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing lpTreeWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(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"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing lpTreeWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(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"</Command>
</CustomBuild>
<ClInclude Include="..\..\src\lpbdesigner\CDetectorUI.h" />
<ClInclude Include="..\..\src\lpbdesigner\RoiItem.h" />
<CustomBuild Include="..\..\src\lpbdesigner\RoiScene.h">
@ -194,9 +184,6 @@
<ClCompile Include="..\..\src\lpbdesigner\GeneratedFiles\Debug\moc_lpImgViewer.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\GeneratedFiles\Debug\moc_lpTreeWidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\GeneratedFiles\Debug\moc_MainFrame.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
@ -224,9 +211,6 @@
<ClCompile Include="..\..\src\lpbdesigner\GeneratedFiles\Release\moc_lpImgViewer.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\GeneratedFiles\Release\moc_lpTreeWidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\GeneratedFiles\Release\moc_MainFrame.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
@ -235,7 +219,6 @@
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\lpdesigner.cpp" />
<ClCompile Include="..\..\src\lpbdesigner\CDetectorUI.cpp" />
<ClCompile Include="..\..\src\lpbdesigner\lpTreeWidget.cpp" />
<ClCompile Include="..\..\src\lpbdesigner\MainFrame.cpp" />
<ClCompile Include="..\..\src\lpbdesigner\RoiItem.cpp" />
<ClCompile Include="..\..\src\lpbdesigner\RoiScene.cpp" />

@ -93,9 +93,6 @@
<CustomBuild Include="lpImgViewer.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="..\..\src\lpbdesigner\lpTreeWidget.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="..\..\src\lpbdesigner\algela\lpImgViewer.h">
<Filter>algela</Filter>
</CustomBuild>
@ -155,9 +152,6 @@
<ClCompile Include="..\..\src\lpbdesigner\SystemStateInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\lpTreeWidget.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\GeneratedFiles\Debug\moc_MainFrame.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
@ -191,12 +185,6 @@
<ClCompile Include="..\..\src\lpbdesigner\algela\lpImgViewer.cpp">
<Filter>algela</Filter>
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\GeneratedFiles\Debug\moc_lpTreeWidget.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\GeneratedFiles\Release\moc_lpTreeWidget.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\lpbdesigner\RoiScene.cpp">
<Filter>Source Files</Filter>
</ClCompile>

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

@ -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();

@ -1341,7 +1341,7 @@ cv::Point2f ValveDetector::getCenter(Mat & imgSrc, Point2f pt, InputParam &param
}
return pt;
}
/*
void ValveDetector::drawToImage(Mat &img, InputParam &paramIn, OutputParam &paramOut)
{
if (img.empty())
@ -1396,5 +1396,5 @@ void ValveDetector::drawToImage(Mat &img, InputParam &paramIn, OutputParam &para
}
cv::circle(img, paramIn.ptCenter, 3, LP_COLOR_BLUE, 2);
}
*/
//void ValveDetector::drawAngle()

@ -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 &centerTempl, InputParam paramIn, Point2f pt, Mat& rstMat);
//bool saveResult(Mat &img, InputParam &paramIn, OutputParam &paramOut, QString modelStr);
bool isValid(Mat target, Mat templ, Point2f pt, int validThresh);
void drawToImage(Mat &img, InputParam &paramIn, OutputParam &paramOut);
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);
};

Loading…
Cancel
Save