|
|
|
@ -168,8 +168,8 @@ QString SmokeBoxIdentification::saveImage(ILImagePtr image, const cv::Mat& imgMa
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cv::imwrite(filePath.toStdString(), imgMat3D);
|
|
|
|
cv::imwrite(filePath.toStdString(), imgMat3D);
|
|
|
|
int lastPos = filePath.lastIndexOf('.');
|
|
|
|
int lastPos = filePath.lastIndexOf('.');
|
|
|
|
QString pclPath = filePath.left(lastPos);
|
|
|
|
QString prePath = filePath.left(lastPos);
|
|
|
|
pclPath.append(".pcd");
|
|
|
|
QString pclPath = prePath + ".pcd";
|
|
|
|
if (QFile(pclPath).exists())
|
|
|
|
if (QFile(pclPath).exists())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QFile::remove(pclPath);
|
|
|
|
QFile::remove(pclPath);
|
|
|
|
@ -180,7 +180,7 @@ QString SmokeBoxIdentification::saveImage(ILImagePtr image, const cv::Mat& imgMa
|
|
|
|
QFile::rename(".\\Cache\\1.pcd", pclPath);
|
|
|
|
QFile::rename(".\\Cache\\1.pcd", pclPath);
|
|
|
|
|
|
|
|
|
|
|
|
qDebug() << "Save 3D image: " << pclPath;
|
|
|
|
qDebug() << "Save 3D image: " << pclPath;
|
|
|
|
return pclPath;
|
|
|
|
return prePath + ".PNG";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // 2D相机数据
|
|
|
|
else // 2D相机数据
|
|
|
|
@ -196,9 +196,9 @@ void SmokeBoxIdentification::saveImage(const QVector<ImageInfo>& vecImageInfo, i
|
|
|
|
QString dataSaveFolderPath;
|
|
|
|
QString dataSaveFolderPath;
|
|
|
|
|
|
|
|
|
|
|
|
#if IMAGEDRAWING==LPV
|
|
|
|
#if IMAGEDRAWING==LPV
|
|
|
|
if (m_currtIntoStockInfo.taskNum == '0')
|
|
|
|
if (m_currtIntoStockInfo.taskNum == "0")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dataSaveFolderPath = QString("%1\\%2\\%3").arg(FILE_INPUTSTORE_PATH)
|
|
|
|
dataSaveFolderPath = QString("%1\\%2\\%3\\%4").arg(FILE_INPUTSTORE_PATH)
|
|
|
|
.arg(m_currtIntoStockInfo.streetName).arg(m_currtIntoStockInfo.Floor).arg(m_currtIntoStockInfo.row);
|
|
|
|
.arg(m_currtIntoStockInfo.streetName).arg(m_currtIntoStockInfo.Floor).arg(m_currtIntoStockInfo.row);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@ -246,8 +246,8 @@ void SmokeBoxIdentification::saveImage(const QVector<ImageInfo>& vecImageInfo, i
|
|
|
|
#if IMAGEDRAWING == LPV
|
|
|
|
#if IMAGEDRAWING == LPV
|
|
|
|
QString filePath = QString("%1\\%2").arg(dataSaveFolderPath).arg(fileInfo.name);
|
|
|
|
QString filePath = QString("%1\\%2").arg(dataSaveFolderPath).arg(fileInfo.name);
|
|
|
|
QString imgPath = saveImage(vecImageInfo.at(i).imageOrigin, vecImageInfo.at(i).image3D, filePath);
|
|
|
|
QString imgPath = saveImage(vecImageInfo.at(i).imageOrigin, vecImageInfo.at(i).image3D, filePath);
|
|
|
|
|
|
|
|
m_currtIntoStockInfo.correctness = 1;
|
|
|
|
if (workMode == WorkMode::IntoStock && imgPath!="")
|
|
|
|
if (!vecImageInfo.at(i).image3D.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_currtIntoStockInfo.imagesPathList.push_back(imgPath);
|
|
|
|
m_currtIntoStockInfo.imagesPathList.push_back(imgPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -406,7 +406,7 @@ Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg)
|
|
|
|
|
|
|
|
|
|
|
|
//m_workMode = WorkMode::Capture;
|
|
|
|
//m_workMode = WorkMode::Capture;
|
|
|
|
m_currtIntoStockInfo.taskNum = strList.at(3);
|
|
|
|
m_currtIntoStockInfo.taskNum = strList.at(3);
|
|
|
|
if (m_currtIntoStockInfo.taskNum == '0')
|
|
|
|
if (m_currtIntoStockInfo.taskNum == "0")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
qDebug() << "入库取图开始";
|
|
|
|
qDebug() << "入库取图开始";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -433,6 +433,8 @@ Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg)
|
|
|
|
QStringList streetInfo = strList.at(1).split("/");
|
|
|
|
QStringList streetInfo = strList.at(1).split("/");
|
|
|
|
m_currtStockCheckInfo.streetName = streetInfo.at(0);
|
|
|
|
m_currtStockCheckInfo.streetName = streetInfo.at(0);
|
|
|
|
m_currtStockCheckInfo.Floor = streetInfo.at(1).toInt();
|
|
|
|
m_currtStockCheckInfo.Floor = streetInfo.at(1).toInt();
|
|
|
|
|
|
|
|
m_currtStockCheckInfo.row = streetInfo.at(2).toInt();
|
|
|
|
|
|
|
|
|
|
|
|
m_currtStockCheckInfo.id = strList.at(2);
|
|
|
|
m_currtStockCheckInfo.id = strList.at(2);
|
|
|
|
m_currtStockCheckInfo.taskNum = strList.at(3);
|
|
|
|
m_currtStockCheckInfo.taskNum = strList.at(3);
|
|
|
|
m_currtStockCheckInfo.stockLocation = strList.at(4);
|
|
|
|
m_currtStockCheckInfo.stockLocation = strList.at(4);
|
|
|
|
@ -457,6 +459,7 @@ void SmokeBoxIdentification::calculate(int stocketID)
|
|
|
|
QtConcurrent::run([=] {
|
|
|
|
QtConcurrent::run([=] {
|
|
|
|
|
|
|
|
|
|
|
|
bool bRlt = false;
|
|
|
|
bool bRlt = false;
|
|
|
|
|
|
|
|
bool bRlt3D = false;
|
|
|
|
StockCheckInfo stocket = m_stocketList.value(stocketID);
|
|
|
|
StockCheckInfo stocket = m_stocketList.value(stocketID);
|
|
|
|
if (!m_stocketList.contains(stocketID))
|
|
|
|
if (!m_stocketList.contains(stocketID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -529,41 +532,71 @@ void SmokeBoxIdentification::calculate(int stocketID)
|
|
|
|
|
|
|
|
|
|
|
|
FileInfo fileInfo = imgInfo.saveImgInfo;
|
|
|
|
FileInfo fileInfo = imgInfo.saveImgInfo;
|
|
|
|
//根据相机编号,对应找到3D基准文件去计算层高
|
|
|
|
//根据相机编号,对应找到3D基准文件去计算层高
|
|
|
|
pclPath.append(QString("*.pcd").arg(fileInfo.strId));
|
|
|
|
pclPath.append("\\");
|
|
|
|
|
|
|
|
pclPath.append(imgInfo.saveImgInfo.name);
|
|
|
|
|
|
|
|
|
|
|
|
QDir dir(pclPath);
|
|
|
|
QString pclPath2 = QString("%1\\%2\\%3\\%4").arg(FILE_INPUTSTORE_PATH)
|
|
|
|
QFileInfoList fileList = dir.entryInfoList(QStringList() << "*.pcd", QDir::Files | QDir::NoDotAndDotDot);
|
|
|
|
.arg(m_currtIntoStockInfo.streetName).arg(m_currtIntoStockInfo.Floor).arg(m_currtIntoStockInfo.row);
|
|
|
|
if (fileList.length() > 0)
|
|
|
|
pclPath2.append("\\");
|
|
|
|
{
|
|
|
|
pclPath2.append(imgInfo.saveImgInfo.name);
|
|
|
|
//盘点时候的点云地址pclPath
|
|
|
|
|
|
|
|
pclPath = fileList[0].absolutePath();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//入库时的点云地址:.\\storeData\\巷道号\\层高\\列数\\*.pcd
|
|
|
|
|
|
|
|
// FILE_INPUTSTORE_PATH \\ m_stocketList[stocketID].streetName\\m_stocketList[stocketID].Floor\\m_stocketList[stocketID].row\\ *.pcd;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str = QString("[%1]:3DCamera %2 -- PointCould = %3").arg(stocket.id)
|
|
|
|
QFile pclFile(pclPath);
|
|
|
|
.arg(imgInfo.cameraSn).arg(pclPath);
|
|
|
|
QFile pclFile2(pclPath);
|
|
|
|
qInfo() << str;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pclFile.exists())
|
|
|
|
|
|
|
|
{
|
|
|
|
int lastPos = pclPath.lastIndexOf('.');
|
|
|
|
int lastPos = pclPath.lastIndexOf('.');
|
|
|
|
QString depthImagePath = pclPath.left(lastPos);
|
|
|
|
QString depthImagePath = pclPath.left(lastPos);
|
|
|
|
|
|
|
|
|
|
|
|
depthImagePath.append(".PNG");
|
|
|
|
depthImagePath.append(".PNG");
|
|
|
|
m_stocketList[stocketID].imagesPathList.append(depthImagePath.right(depthImagePath.length() - 1));
|
|
|
|
m_stocketList[stocketID].imagesPathList.append(depthImagePath);
|
|
|
|
m_stocketList[stocketID].pcdSrc = pclPath;
|
|
|
|
m_stocketList[stocketID].pcdSrc = pclPath;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pclFile.exists() && pclFile2.exists())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str = QString("[%1]:3DCamera %2 -- PointCould = %3; Store PointCloud = %4").arg(stocket.id)
|
|
|
|
|
|
|
|
.arg(imgInfo.cameraSn).arg(pclPath).arg(pclPath2);
|
|
|
|
|
|
|
|
qInfo() << str;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//入库时的点云地址:.\\storeData\\巷道号\\层高\\列数\\*.pcd
|
|
|
|
|
|
|
|
// FILE_INPUTSTORE_PATH \\ m_stocketList[stocketID].streetName\\m_stocketList[stocketID].Floor\\m_stocketList[stocketID].row\\ *.pcd;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString jsonPath = QCoreApplication::applicationDirPath() + "\\config\\param3d.json";
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bRlt3D = compare(pclPath2.toStdString(), pclPath.toStdString(), jsonPath.toStdString());
|
|
|
|
|
|
|
|
str = QString("[%1]:3DCamera %2 -- 3D compare Result = %3").arg(stocket.id)
|
|
|
|
|
|
|
|
.arg(imgInfo.cameraSn).arg(QString::number(bRlt3D));
|
|
|
|
|
|
|
|
qInfo() << str;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (const std::exception& e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
qWarning() << e.what();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (pclFile.exists())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
str = QString("[%1]:3DCamera %2 -- PointCould[%3] can't Find!").arg(stocket.id)
|
|
|
|
|
|
|
|
.arg(imgInfo.cameraSn).arg(pclPath2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(pclFile2.exists())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
str = QString("[%1]:3DCamera %2 -- PointCould[%3] can't Find!").arg(stocket.id)
|
|
|
|
str = QString("[%1]:3DCamera %2 -- PointCould[%3] can't Find!").arg(stocket.id)
|
|
|
|
.arg(imgInfo.cameraSn).arg(pclPath);
|
|
|
|
.arg(imgInfo.cameraSn).arg(pclPath);
|
|
|
|
qWarning() << str;
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
str = QString("[%1]:3DCamera %2 -- PointCould[%3; %4] can't Find!").arg(stocket.id)
|
|
|
|
|
|
|
|
.arg(imgInfo.cameraSn).arg(pclPath).arg(pclPath2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qWarning() << str;
|
|
|
|
|
|
|
|
}
|
|
|
|
//数量计算
|
|
|
|
|
|
|
|
m_stocketList[stocketID].smokeQuantityRlt = m_stocketList[stocketID].smokeQuantity;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@ -581,6 +614,15 @@ void SmokeBoxIdentification::calculate(int stocketID)
|
|
|
|
|
|
|
|
|
|
|
|
m_stocketList[stocketID].imagesPathList = set.toList(); // 将 QSet 转换为 QStringList
|
|
|
|
m_stocketList[stocketID].imagesPathList = set.toList(); // 将 QSet 转换为 QStringList
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bRlt3D)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_stocketList[stocketID].smokeQuantityRlt = m_stocketList[stocketID].smokeQuantity;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_stocketList[stocketID].smokeQuantityRlt = "0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!bRlt)
|
|
|
|
if (!bRlt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_stocketList[stocketID].smokeTypeNumRlt = "0";
|
|
|
|
m_stocketList[stocketID].smokeTypeNumRlt = "0";
|
|
|
|
@ -749,6 +791,7 @@ void SmokeBoxIdentification::sendResults(int mode, int id)
|
|
|
|
.append(m_currtIntoStockInfo.stockLocation).append(SPLIT_RULE)
|
|
|
|
.append(m_currtIntoStockInfo.stockLocation).append(SPLIT_RULE)
|
|
|
|
.append(m_currtIntoStockInfo.smokeTypeNum).append(SPLIT_RULE)
|
|
|
|
.append(m_currtIntoStockInfo.smokeTypeNum).append(SPLIT_RULE)
|
|
|
|
.append(m_currtIntoStockInfo.smokeQuantity).append(SPLIT_RULE)
|
|
|
|
.append(m_currtIntoStockInfo.smokeQuantity).append(SPLIT_RULE)
|
|
|
|
|
|
|
|
.append(QString::number(m_currtIntoStockInfo.correctness)).append(SPLIT_RULE)
|
|
|
|
.append(m_currtIntoStockInfo.imagesPathList.join(";")).append(END_SYMBOL);
|
|
|
|
.append(m_currtIntoStockInfo.imagesPathList.join(";")).append(END_SYMBOL);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|