diff --git a/runner17/Release/smokeBox.exe b/runner17/Release/smokeBox.exe index a8c83a1..f225158 100644 Binary files a/runner17/Release/smokeBox.exe and b/runner17/Release/smokeBox.exe differ diff --git a/runner17/Release/smokeBox.pdb b/runner17/Release/smokeBox.pdb index ef85868..910fc86 100644 Binary files a/runner17/Release/smokeBox.pdb and b/runner17/Release/smokeBox.pdb differ diff --git a/src/SmokeBoxIdentification.cpp b/src/SmokeBoxIdentification.cpp index 5158a59..21291cf 100644 --- a/src/SmokeBoxIdentification.cpp +++ b/src/SmokeBoxIdentification.cpp @@ -155,12 +155,12 @@ void SmokeBoxIdentification::saveImage(const cv::Mat& imgMat, const QString& fil qDebug() << "Save image: " << filePath; } -void SmokeBoxIdentification::saveImage(ILImagePtr image, const cv::Mat& imgMat3D, const QString& filePath) +QString SmokeBoxIdentification::saveImage(ILImagePtr image, const cv::Mat& imgMat3D, const QString& filePath) { if (image->Void()) { qWarning() << "Image is empty"; - return; + return ""; } std::wstring path = filePath.toStdWString(); @@ -179,23 +179,15 @@ void SmokeBoxIdentification::saveImage(ILImagePtr image, const cv::Mat& imgMat3D //QFile::copy("C:\\Users\\LENOVO\\Downloads\\30t.pcd",pclPath); QFile::rename(".\\Cache\\1.pcd", pclPath); - qDebug() << "Save 3D image: " << filePath; + qDebug() << "Save 3D image: " << pclPath; + return pclPath; + } else // 2D相机数据 { image->Save(path.c_str(), nullptr); qDebug() << "Save 2D image: " << filePath; - } - - - - if (!imgMat3D.empty()) - { - int lastPos = filePath.lastIndexOf('.'); - QString pclPath = filePath.left(lastPos); - pclPath.append(".pcd"); - cv::imwrite(filePath.toStdString(), imgMat3D); - qDebug() << "Save PointCould: " << filePath; + return filePath; } } @@ -204,8 +196,18 @@ void SmokeBoxIdentification::saveImage(const QVector& vecImageInfo, i QString dataSaveFolderPath; #if IMAGEDRAWING==LPV - dataSaveFolderPath = QString("%1\\%2\\%3").arg(FILE_STORAGE_PATH)/*.arg(ORIGIN_IMAGE_FOLDER)*/ - .arg(m_currtIntoStockInfo.taskNum).arg(m_currtIntoStockInfo.id); + if (m_currtIntoStockInfo.taskNum == '0') + { + dataSaveFolderPath = QString("%1\\%2\\%3").arg(FILE_INPUTSTORE_PATH) + .arg(m_currtIntoStockInfo.streetName).arg(m_currtIntoStockInfo.Floor).arg(m_currtIntoStockInfo.row); + } + else + { + dataSaveFolderPath = QString("%1\\%2\\%3").arg(FILE_STORAGE_PATH)/*.arg(ORIGIN_IMAGE_FOLDER)*/ + .arg(m_currtIntoStockInfo.taskNum).arg(m_currtIntoStockInfo.id); + } + + #elif IMAGEDRAWING==OPENCV switch (workMode) { @@ -243,7 +245,12 @@ void SmokeBoxIdentification::saveImage(const QVector& vecImageInfo, i #if IMAGEDRAWING == LPV QString filePath = QString("%1\\%2").arg(dataSaveFolderPath).arg(fileInfo.name); - saveImage(vecImageInfo.at(i).imageOrigin, vecImageInfo.at(i).image3D, filePath); + QString imgPath = saveImage(vecImageInfo.at(i).imageOrigin, vecImageInfo.at(i).image3D, filePath); + + if (workMode == WorkMode::IntoStock && imgPath!="") + { + m_currtIntoStockInfo.imagesPathList.push_back(imgPath); + } #elif IMAGEDRAWING == OPENCV if (workMode == WorkMode::IntoStock) @@ -396,14 +403,24 @@ Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg) qDebug() << "strlist length: " << strList.length() << " head: " << strList.at(0); if (strList.at(0) == START_CAPTURE && strList.length() == 7) { - qDebug() << "到位取图开始"; + //m_workMode = WorkMode::Capture; + m_currtIntoStockInfo.taskNum = strList.at(3); + if (m_currtIntoStockInfo.taskNum == '0') + { + qDebug() << "入库取图开始"; + } + else + { + qDebug() << "到位取图开始"; + } QStringList streetInfo = strList.at(1).split("/"); m_currtIntoStockInfo.streetName = streetInfo.at(0); m_currtIntoStockInfo.Floor = streetInfo.at(1).toInt(); + m_currtIntoStockInfo.row = streetInfo.at(2).toInt(); + m_currtIntoStockInfo.id = strList.at(2); - m_currtIntoStockInfo.taskNum = strList.at(3); m_currtIntoStockInfo.stockLocation = strList.at(4); m_currtIntoStockInfo.smokeTypeNum = strList.at(5); m_currtIntoStockInfo.smokeQuantity = strList.at(6); @@ -529,6 +546,7 @@ void SmokeBoxIdentification::calculate(int stocketID) depthImagePath.append(".PNG"); m_stocketList[stocketID].imagesPathList.append(depthImagePath.right(depthImagePath.length() - 1)); + m_stocketList[stocketID].pcdSrc = pclPath; } else { @@ -550,14 +568,14 @@ void SmokeBoxIdentification::calculate(int stocketID) m_stocketList[stocketID].smokeQuantityRlt = m_stocketList[stocketID].smokeQuantity; //QFile::copy("C:\\Users\\LENOVO\\Downloads\\30t.pcd",pclPath); - QFile::rename(".\\Cache\\1.pcd", pclPath); + //QFile::rename(".\\Cache\\1.pcd", pclPath); } else { - CameraControl* cameraCon = CameraControl::instance(); - m_stocketList[stocketID].pcdSrc = pclPath.replace(".", "").append("\\").append(QString::number((cameraCon->getDeviceId(imgInfo.cameraSn)))).append(".pcd"); - qDebug() << "pcdSrc:" << m_stocketList[stocketID].pcdSrc; + //CameraControl* cameraCon = CameraControl::instance(); + //m_stocketList[stocketID].pcdSrc = pclPath.replace(".", "").append("\\").append(QString::number((cameraCon->getDeviceId(imgInfo.cameraSn)))).append(".pcd"); + //qDebug() << "pcdSrc:" << m_stocketList[stocketID].pcdSrc; QString str = QString("[%1]:Pre 2D Camera don't Match. Now Camera %2.").arg(stocket.id).arg(imgInfo.cameraSn); qDebug() << str; } @@ -693,7 +711,8 @@ void SmokeBoxIdentification::sendResults(int mode, int id) break; case eCommunicationRules::emSJZ: resultInfoMsg.append(RETURN_CALCULATE).append(SPLIT_RULE) - .append(m_stocketList.value(id).streetName).append("/").append(QString::number(m_stocketList.value(id).Floor)).append(SPLIT_RULE) + .append(m_stocketList.value(id).streetName).append("/").append(QString::number(m_stocketList.value(id).Floor)) + .append("/").append(QString::number(m_stocketList.value(id).row)).append(SPLIT_RULE) .append(m_stocketList.value(id).id).append(SPLIT_RULE) .append(m_stocketList.value(id).taskNum).append(SPLIT_RULE) .append(m_stocketList.value(id).stockLocation).append(SPLIT_RULE) @@ -731,12 +750,14 @@ void SmokeBoxIdentification::sendResults(int mode, int id) case eCommunicationRules::emSJZ: { resultInfoMsg.append(END_CAPTURE).append(SPLIT_RULE) - .append(m_currtIntoStockInfo.streetName).append("/").append(QString::number(m_currtIntoStockInfo.Floor)).append(SPLIT_RULE) + .append(m_currtIntoStockInfo.streetName).append("/").append(QString::number(m_currtIntoStockInfo.Floor)) + .append("/").append(QString::number(m_currtIntoStockInfo.row)).append(SPLIT_RULE) .append(m_currtIntoStockInfo.id).append(SPLIT_RULE) .append(m_currtIntoStockInfo.taskNum).append(SPLIT_RULE) .append(m_currtIntoStockInfo.stockLocation).append(SPLIT_RULE) .append(m_currtIntoStockInfo.smokeTypeNum).append(SPLIT_RULE) - .append(m_currtIntoStockInfo.smokeQuantity).append(END_SYMBOL); + .append(m_currtIntoStockInfo.smokeQuantity).append(SPLIT_RULE) + .append(m_currtIntoStockInfo.imagesPathList.join(";")).append(END_SYMBOL); break; } default: diff --git a/src/SmokeBoxIdentification.h b/src/SmokeBoxIdentification.h index 14713fe..b0f52c0 100644 --- a/src/SmokeBoxIdentification.h +++ b/src/SmokeBoxIdentification.h @@ -98,7 +98,7 @@ private: void captureSide(int cameraID, int floor); void saveImage(const QVector& vecImageInfo, int workMode); void saveImage(const cv::Mat& imgMat, const QString& filePath); - void saveImage(ILImagePtr image, const cv::Mat& imgMat3D, const QString& filePath); + QString saveImage(ILImagePtr image, const cv::Mat& imgMat3D, const QString& filePath); bool decodeSmokeInfoCsv(const QString& filePath); bool matchSmokeNameAndTemplateFolderName(const QString& folderPath); diff --git a/src/common/commonDefine.h b/src/common/commonDefine.h index ebfc73a..6080432 100644 --- a/src/common/commonDefine.h +++ b/src/common/commonDefine.h @@ -36,6 +36,7 @@ #define SMOKEINFO_XLSX_CONFIG "\\user\\smokeInfo.xlsx" #define FILE_STORAGE_PATH ".\\fileData" +#define FILE_INPUTSTORE_PATH ".\\storeData" #define INTOSTOCK_IMAGE_FOLDER "intoStock" #define ORIGIN_IMAGE_FOLDER "Origin" #define TYPE_TEMPLATE_PATH ".\\templateImg" @@ -153,6 +154,7 @@ struct IntoStockInfo QString smokeTypeNum; //上位机发送的品规号37010106 QString smokeQuantity; //上位机发送的数量30 int Floor = 1; //层数,表示现在拍的货物在高架库的第几层 + int row = 0; //列数,表示现在拍的货物在高架库的第几列 QStringList imagesPathList; @@ -191,6 +193,7 @@ struct StockCheckInfo QString pcdSrc; //盘点识别文件 int Floor = 1; //层数,表示现在拍的货物在高架库的第几层 + int row = 0; //列数,表示现在拍的货物在高架库的第几列 //void clear() //{ // streetName.clear(); diff --git a/tpvs17/SmokeBoxIdentification/SmokeBoxIdentification.vcxproj b/tpvs17/SmokeBoxIdentification/SmokeBoxIdentification.vcxproj index 0cb2123..2b079d8 100644 --- a/tpvs17/SmokeBoxIdentification/SmokeBoxIdentification.vcxproj +++ b/tpvs17/SmokeBoxIdentification/SmokeBoxIdentification.vcxproj @@ -28,11 +28,11 @@ - msvc2017_64-5.9.4 + 5.9.4_msvc2017_64 core;gui;network;quickwidgets;serialport;websockets;widgets;winextras - msvc2017_64-5.9.4 + 5.9.4_msvc2017_64 core;network;gui;widgets;serialport;websockets;winextras;quickwidgets @@ -54,12 +54,12 @@ smokeBoxd D:\Qt\5.9.4\msvc2017_64\include;$(IncludePath) D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64;$(ExecutablePath) - D:\Qt\5.9.4\msvc2017_64\lib;$(LibraryPath) + C:\Qt\Qt5.9.4\5.9.4\msvc2017_64\lib;D:\Qt\5.9.4\msvc2017_64\lib;$(LibraryPath) $(SolutionDir)..\runner17\$(Configuration)\ smokeBox - D:\Qt\5.9.4\msvc2017_64\lib;$(LibraryPath) + C:\Qt\Qt5.9.4\5.9.4\msvc2017_64\lib;D:\Qt\5.9.4\msvc2017_64\lib;$(LibraryPath) $(IncludePath) diff --git a/tpvs17/SmokeBoxIdentification/SmokeBoxIdentification.vcxproj.user b/tpvs17/SmokeBoxIdentification/SmokeBoxIdentification.vcxproj.user index be679b1..dc250b5 100644 --- a/tpvs17/SmokeBoxIdentification/SmokeBoxIdentification.vcxproj.user +++ b/tpvs17/SmokeBoxIdentification/SmokeBoxIdentification.vcxproj.user @@ -10,9 +10,9 @@ WindowsLocalDebugger - 2024-02-21T09:18:16.3023274Z + 2024-04-18T09:37:16.2684852Z - 2024-02-25T01:36:44.5600966Z + 2024-04-18T09:37:16.3134853Z \ No newline at end of file