1、修改相机打开逻辑,支持其中一个相机异常情况下能打开其他相机。2、修复图片旋转180度错误的问题。3、优化数量匹配算法,修改使数量模板和当前数据量一致的逻辑。

LanXin3D
QuShuailong 2 years ago
parent 9288237f10
commit c6d7805f0b

@ -5,6 +5,7 @@ ADModule::ADModule(QObject *parent): QObject(parent)
,m_mutex(QMutex::Recursive) ,m_mutex(QMutex::Recursive)
{ {
qRegisterMetaType<QVector<QVector<double>>>("QVector<QVector<double>>"); qRegisterMetaType<QVector<QVector<double>>>("QVector<QVector<double>>");
qRegisterMetaType<QVector<QString>>("QVector<QString>");
m_vecFmat = std::make_shared<matGroup>(); m_vecFmat = std::make_shared<matGroup>();
m_pThread = new QThread(); m_pThread = new QThread();
moveToThread(m_pThread); moveToThread(m_pThread);

@ -163,24 +163,35 @@ bool CameraControl::initCamera()
qWarning() << "Load camera failed"; qWarning() << "Load camera failed";
return false; return false;
} }
else { else
QStringList serialNumberList = m_mapSerialNumberIdSide.keys();
serialNumberList.append(m_mapSerialNumberIdTop.keys());
if (!openCamera(serialNumberList))
{ {
qWarning() << "Open camera failed"; QStringList serialNumberList = m_mapSNIndex.keys();
return false; for each (const QString& serialNumber in serialNumberList)
{
if (!openCamera(serialNumber))
{
qWarning() << "Open camera: " << serialNumber << " failed";
continue;
} }
else { else
if (!startCamera(serialNumberList))
{ {
qWarning() << "Start camera failed"; qDebug() << "Open camera: " << serialNumber << " successed";
return false; if (!startCamera(serialNumber))
{
qWarning() << "Start camera: " << serialNumber << " failed";
continue;
} }
else { else
if (!setSoftwareTrigger(serialNumberList)) {
qDebug() << "Start camera: " << serialNumber << " successed";
if (!setSoftwareTrigger(serialNumber))
{
qWarning() << "Set camera: " << serialNumber << " software trigger failed";
}
else
{ {
qWarning() << "Set software trigger failed"; qDebug() << "Set camera: " << serialNumber << " software trigger successed";
}
} }
} }
} }
@ -212,10 +223,12 @@ bool CameraControl::loadCamera(const QList<CameraInfo>& cameraInfoList)
else else
{ {
qWarning() << "SerialNumber: " << serialNumber << " init failed"; qWarning() << "SerialNumber: " << serialNumber << " init failed";
flag = true; DELETE_POINTER(pHikCamera);
//flag = false;
} }
} }
} }
qDebug() << "m_vecPCamera size: " << m_vecPCamera.size();
return flag; return flag;
} }
bool CameraControl::openCamera(const QStringList& serialNumberList) bool CameraControl::openCamera(const QStringList& serialNumberList)
@ -439,12 +452,20 @@ void CameraControl::capture(const QStringList& serialNumberList)
{ {
int len = serialNumberList.length(); int len = serialNumberList.length();
qDebug() << "start capture, length: " << len; qDebug() << "start capture, length: " << len;
QVector<ImageInfo> vecImageInfo(len); QVector<ImageInfo> vecImageInfo;
for (int i = 0; i < len; ++i) for (int i = 0; i < len; ++i)
{ {
QString serialNumber = serialNumberList.at(i); QString serialNumber = serialNumberList.at(i);
getSaveImgNameInfo(serialNumber, vecImageInfo[i].saveImgInfo); if (!m_mapSNIndex.contains(serialNumber))
int id = vecImageInfo.at(i).saveImgInfo.strId.toInt(); {
qWarning() << "m_vecPCamera does not have camera: " << serialNumber;
continue;
}
ImageInfo imgInfo;
FileInfo saveImgInfo;
getSaveImgNameInfo(serialNumber, saveImgInfo);
imgInfo.saveImgInfo = saveImgInfo;
int id = saveImgInfo.strId.toInt();
int rotationAngle = 0; int rotationAngle = 0;
if (m_mapIdCameraInfoTop.contains(id)) if (m_mapIdCameraInfoTop.contains(id))
{ {
@ -454,9 +475,9 @@ void CameraControl::capture(const QStringList& serialNumberList)
{ {
rotationAngle = m_mapIdCameraInfoSide.value(id).rotationAngle; rotationAngle = m_mapIdCameraInfoSide.value(id).rotationAngle;
} }
flipImg(capture(serialNumber), vecImageInfo[i].image, rotationAngle); flipImg(capture(serialNumber), imgInfo.image, rotationAngle);
//vecImageInfo[i].image = capture(serialNumber); imgInfo.cameraSn = serialNumber;
vecImageInfo[i].cameraSn = serialNumber; vecImageInfo.push_back(imgInfo);
} }
emit sgCapturedImage(vecImageInfo, m_eCameraLocation); emit sgCapturedImage(vecImageInfo, m_eCameraLocation);
} }
@ -476,7 +497,7 @@ void CameraControl::flipImg(const cv::Mat& imgSrc, cv::Mat& imgDst, int rotation
qDebug() << " Ðýת90¶È"; qDebug() << " Ðýת90¶È";
break; break;
case 180: case 180:
cv::flip(imgSrc, imgDst, 0); cv::flip(imgSrc, imgDst, -1);
qDebug() << " Ðýת180¶È"; qDebug() << " Ðýת180¶È";
break; break;
case 270: case 270:

@ -65,8 +65,14 @@ void CategoryMatcher::setILMatch(const MatchParam& matchParam)
m_ilmatchPtr->AcceptScore = m_matchParam.AcceptScore; m_ilmatchPtr->AcceptScore = m_matchParam.AcceptScore;
} }
} }
bool CategoryMatcher::smokeMatch(const QString& typeNo, const cv::Mat& inputMat, cv::Mat& rltMat) bool CategoryMatcher::smokeMatch(const QString& typeNo, const cv::Mat& inputMat, cv::Mat& rltMat)
{ {
if (inputMat.empty())
{
qWarning() << "inputMat is empty";
return false;
}
ILImagePtr ilImgGray(__uuidof(LImage)); ILImagePtr ilImgGray(__uuidof(LImage));
cv::Mat imgMatGray; cv::Mat imgMatGray;
ensureGrayImg(inputMat, imgMatGray); ensureGrayImg(inputMat, imgMatGray);

@ -29,6 +29,7 @@ bool HikCamera::initCamera(const QString& serialNumber)
return false;; return false;;
} }
int deviceNum = stDeviceList.nDeviceNum; int deviceNum = stDeviceList.nDeviceNum;
bool findInitFlag = false;
if (deviceNum == 0) if (deviceNum == 0)
{ {
qWarning() << "Do not found any device!"; qWarning() << "Do not found any device!";
@ -68,12 +69,13 @@ bool HikCamera::initCamera(const QString& serialNumber)
qWarning() << "Can't connect: " << serialNumber; qWarning() << "Can't connect: " << serialNumber;
return false; return false;
} }
findInitFlag = true;
break; break;
} }
} }
} }
} }
return true; return findInitFlag;
} }
//void HikCamera::initCamera(const void* pDeviceInfo) //void HikCamera::initCamera(const void* pDeviceInfo)

@ -41,7 +41,8 @@ SmokeBoxIdentification::SmokeBoxIdentification(QWidget *parent)
m_pTcpClientThread = new QThread(); m_pTcpClientThread = new QThread();
m_pNetControl->moveToThread(m_pTcpClientThread); m_pNetControl->moveToThread(m_pTcpClientThread);
m_pTcpClientThread->start(); m_pTcpClientThread->start();
connect(m_pNetControl, &NetControl::sgReceiveData, this, &SmokeBoxIdentification::onDecodeMsg); connect(m_pNetControl, &NetControl::sgReceiveData, this, &SmokeBoxIdentification::onDecodeMsg, Qt::QueuedConnection);
connect(this, &SmokeBoxIdentification::sgSendMsg, m_pNetControl, &NetControl::onSendMsg, Qt::QueuedConnection);
ADModule::instance()->loadParameters(filePath); ADModule::instance()->loadParameters(filePath);
filePath = applicationDirPath + COM_CONFIG; filePath = applicationDirPath + COM_CONFIG;
lpSerialStation::instance()->loadParameters(filePath); lpSerialStation::instance()->loadParameters(filePath);
@ -72,7 +73,6 @@ SmokeBoxIdentification::SmokeBoxIdentification(QWidget *parent)
//connect(this, &SmokeBoxIdentification::sgSendData2AndAlgo, ADModule::instance(), &ADModule::onSendData2Algo); //connect(this, &SmokeBoxIdentification::sgSendData2AndAlgo, ADModule::instance(), &ADModule::onSendData2Algo);
//connect(this, &SmokeBoxIdentification::sgSaveSensorData2Local, ADModule::instance(), &ADModule::onSaveData2File); //connect(this, &SmokeBoxIdentification::sgSaveSensorData2Local, ADModule::instance(), &ADModule::onSaveData2File);
//connect(this, &SmokeBoxIdentification::sgSendResults, this, &SmokeBoxIdentification::onSendResults); //connect(this, &SmokeBoxIdentification::sgSendResults, this, &SmokeBoxIdentification::onSendResults);
connect(this, &SmokeBoxIdentification::sgSendMsg, m_pNetControl, &NetControl::onSendMsg, Qt::QueuedConnection);
connect(ui.action_templateNum, SIGNAL(triggered()), this, SLOT(onActionClicked())); connect(ui.action_templateNum, SIGNAL(triggered()), this, SLOT(onActionClicked()));
emit sgControlSideLight(lightCtrl::emTurnOnLight); emit sgControlSideLight(lightCtrl::emTurnOnLight);
} }
@ -343,7 +343,7 @@ Q_SLOT void SmokeBoxIdentification::onNumStatistic(QString typeNum)
{ {
templateName = m_mapSmokeName2TemplateFolderName.value(smokeCnName); templateName = m_mapSmokeName2TemplateFolderName.value(smokeCnName);
QtConcurrent::run([=]() { QtConcurrent::run([=]() {
dataPreProcessing::QStandardnormFileMapLabelSsample m = m_pDataProcess->getDataStructure(); dataPreProcessing::QStandardnormFileMapLabelSample m = m_pDataProcess->getDataStructure();
int matchLabel = -2; int matchLabel = -2;
if (m.contains(templateName)) if (m.contains(templateName))
{ {

@ -37,6 +37,14 @@ enum WorkMode
IntoStock IntoStock
}; };
enum StockCheckMode
{
NoVirtual = 0,
TypeVirtual, //品规模拟盘点
NumVirtual, //数量模拟盘点
TypeNumVirtual //品规数量模拟盘点
};
struct IntoStockInfo struct IntoStockInfo
{ {
QString streetName; QString streetName;
@ -150,6 +158,7 @@ private:
StockCheckInfo m_currtStockCheckInfo; StockCheckInfo m_currtStockCheckInfo;
EmptyCheckInfo m_currtEmptyCheckInfo; EmptyCheckInfo m_currtEmptyCheckInfo;
QNumTemplateBuild* m_pNumTemplateBuild{ nullptr }; QNumTemplateBuild* m_pNumTemplateBuild{ nullptr };
StockCheckMode m_stockCheckMode;
QThread* m_pTcpClientThread; QThread* m_pTcpClientThread;
//QLabel* m_pShowRltImgLabel; //QLabel* m_pShowRltImgLabel;

@ -304,7 +304,7 @@ bool dataPreProcessing::loadSampleWithItsCorresLabel(const QString& samplePath)
} }
mLabelMapSample.insert(mLabel.toInt(), mRightLeftMapSample); mLabelMapSample.insert(mLabel.toInt(), mRightLeftMapSample);
} }
m_StandardnormFileMapLabelSsample[dir.dirName()] = mLabelMapSample; m_StandardnormFileMapLabelSample[dir.dirName()] = mLabelMapSample;
return true; return true;
} }
@ -349,8 +349,7 @@ QVector<int> dataPreProcessing::modelPrediction()
return finalLabelVec; return finalLabelVec;
} }
int dataPreProcessing::modelPrediction(const QVector<QVector<double>> dataVec, QString typeSerial, QString leftRightJudge)
int dataPreProcessing::modelPrediction(const QVector<QVector<double>> vec, QString typeSerial, QString leftRightJudge)
{ {
if (leftRightJudge.isEmpty()) if (leftRightJudge.isEmpty())
{ {
@ -358,137 +357,161 @@ int dataPreProcessing::modelPrediction(const QVector<QVector<double>> vec, QStri
} }
//mComparedValMapLabel.clear(); //mComparedValMapLabel.clear();
if (vec.size() <= 0) if (dataVec.size() <= 0)
{ {
qDebug() << "model vec is empty"; qDebug() << "model vec is empty";
return -1; return -1;
} }
QMultiMap<int, QMultiMap<QString, QVector<QVector<double>>>> typeTarLabelMapSampleVec = m_StandardnormFileMapLabelSsample[typeSerial]; QMultiMap<int, QMultiMap<QString, QVector<QVector<double>>>> typeTarLabelMapSampleVec = m_StandardnormFileMapLabelSample[typeSerial];
if (typeTarLabelMapSampleVec.size() == 0) if (typeTarLabelMapSampleVec.size() == 0)
{ {
qDebug() << "typeTarsize"; qDebug() << typeSerial << " do not have template file";
return -1; return -1;
} }
auto convertToVector = [&](const cv::Mat& m, std::vector<double>& v) {
v.clear();
double *p = (double*)m.row(0).data;
for (int i = 0; i < m.cols; i++)
{
v.push_back(p[i]);
}
};
auto dataReshapeAndPretreatment = [&](const QVector<QVector<double>>& srcVec, std::vector<double>& reshapedVec)->bool
{
QVector<double> reshapedTarVec; QVector<double> reshapedTarVec;
loadedDataReshapeForComparison(vec, reshapedTarVec); loadedDataReshapeForComparison(srcVec, reshapedTarVec);
if (reshapedTarVec.size() <= 0) if (reshapedTarVec.size() <= 0)
{ {
qDebug() << "reshape"; qDebug() << "reshapedTarVec is empty";
return -1; return false;
} }
qDebug() << "tarReshapedSize:" << reshapedTarVec.size(); //qDebug() << "tarReshapedSize:" << reshapedTarVec.size();
cv::Mat tarShapeMat(1, reshapedTarVec.size(), CV_64FC1, &reshapedTarVec[0]); cv::Mat tarShapeMat(1, reshapedTarVec.size(), CV_64FC1, &reshapedTarVec[0]);
cv::Mat test; cv::Mat test;
tarShapeMat.convertTo(test, CV_32FC1); tarShapeMat.convertTo(test, CV_32FC1);
cv::Mat dstTarShapeMat; cv::Mat dstTarShapeMat;
cv::medianBlur(test, dstTarShapeMat, 7); cv::medianBlur(test, dstTarShapeMat, 7);
dstTarShapeMat.convertTo(dstTarShapeMat, CV_64FC1); dstTarShapeMat.convertTo(dstTarShapeMat, CV_64FC1);
convertToVector(dstTarShapeMat, reshapedVec);
return true;
};
std::vector<double> dstTarShapeVec; std::vector<double> dstTarShapeVec;
auto convertToVector = [&](const cv::Mat& m, std::vector<double>& v) { if (!dataReshapeAndPretreatment(dataVec, dstTarShapeVec))
double *p = (double*)m.row(0).data;
for (int i = 0; i < m.cols; i++)
{ {
v.push_back(p[i]); return -1;
} }
}; //LB_Improved filter(dstTarShapeVec, dstTarShapeVec.size() / 50.0);
convertToVector(dstTarShapeMat, dstTarShapeVec); //qDebug() << "filter v size: " << filter.getVSize();
LB_Improved filter(dstTarShapeVec, reshapedTarVec.size() / 50.0);
qDebug() << "filter v size: " << filter.getVSize();
//double bestSofar = filter.getLowestCost(); //double bestSofar = filter.getLowestCost();
QMultiMap<int, QMultiMap<QString, QVector<QVector<double>>>>::iterator it;
QVector<QVector<QVector<double>>> loopVec; QVector<QVector<QVector<double>>> loopVec;
QVector<int> labelLoopVec; QVector<int> labelLoopVec;
double disMin = DBL_MAX; double disMin = DBL_MAX;
int bestLabel = -1; int bestLabel = -1;
int bestLabel1 = -1;
//test //test
double globalVal = DBL_MAX; double globalVal = DBL_MAX;
for (it = typeTarLabelMapSampleVec.begin(); it != typeTarLabelMapSampleVec.end(); ++it) { QMultiMap<int, QMultiMap<QString, QVector<QVector<double>>>>::iterator it;
for (it = typeTarLabelMapSampleVec.begin(); it != typeTarLabelMapSampleVec.end(); ++it)
{
//loopVec.push_back(it.value()); //loopVec.push_back(it.value());
//labelLoopVec.push_back(it.key()); //labelLoopVec.push_back(it.key());
const int label = it.key(); const int label = it.key();
//qDebug() << "num folder: " << label; //qDebug() << "num folder: " << label;
QMultiMap<QString, QVector<QVector<double>>> rightLeftMapValueVec = it.value(); QMultiMap<QString, QVector<QVector<double>>> rightLeftMapValueVec = it.value();
QMultiMap<QString, QVector<QVector<double>>>::iterator iterRighLeftMap = rightLeftMapValueVec.begin(); if (!rightLeftMapValueVec.contains(leftRightJudge))
for (iterRighLeftMap; iterRighLeftMap != rightLeftMapValueVec.end(); iterRighLeftMap++)
{ {
const QString& leftOrRight = iterRighLeftMap.key(); qWarning() << QString("%1 %2 do not have %3 template file!").arg(typeSerial)
//qDebug() << "leftOrRight: " << leftOrRight; .arg(label).arg(leftRightJudge);
if (leftOrRight == leftRightJudge) continue;
}
for(const QVector<QVector<double>>& srcSampleVec : rightLeftMapValueVec.values(leftRightJudge))
{ {
QVector<double> reshapedSampleVec; if (srcSampleVec.size() <= 0)
loadedDataReshapeForComparison(iterRighLeftMap.value(), reshapedSampleVec);
if (reshapedSampleVec.size() < 0)
{ {
QString msg = QString("%1: %2 %3 data is empty").arg(typeSerial).arg(label).arg(leftOrRight);
qDebug() << msg; qWarning() << QString("%1 %2 %3 template data is empty!").arg(typeSerial)
.arg(label).arg(leftRightJudge);
continue; continue;
} }
cv::Mat tarShapeSampleMat(1, reshapedSampleVec.size(), CV_64FC1, &reshapedSampleVec[0]);
cv::Mat testSample;
tarShapeSampleMat.convertTo(testSample, CV_32FC1);
cv::Mat dstSampleTarShapeMat;
cv::medianBlur(testSample, dstSampleTarShapeMat, 5);
dstSampleTarShapeMat.convertTo(dstSampleTarShapeMat, CV_64FC1);
std::vector<double> sampleVec; std::vector<double> sampleVec;
convertToVector(dstSampleTarShapeMat, sampleVec); std::vector<double> newDstTarShapeVec(dstTarShapeVec);
std::vector<double> sampleNewVec(sampleVec); if (srcSampleVec.first().size() < dataVec.first().size())
std::vector<double> dstTarShapeNewVec(dstTarShapeVec); {
//qDebug() << "sampleVec size: " << sampleVec.size() << ", dstTarShapeVec size: " QVector<QVector<double>> newDataVec;
// << dstTarShapeVec.size(); int minSize = srcSampleVec.first().size();
//qDebug() << "reshapedSampleVec size: " << reshapedSampleVec.size() << ", reshapedTarVec size: " for (int i = 0; i < dataVec.size(); ++i)
// << reshapedTarVec.size(); {
if (reshapedSampleVec.size() != reshapedTarVec.size()) QVector<double> subVec = dataVec[i];
{ subVec.resize(minSize);
//qDebug() << "something wrong with sample vec size"; newDataVec.push_back(subVec);
if (sampleVec.size() > dstTarShapeVec.size())
{
sampleNewVec.resize(dstTarShapeVec.size());
//qDebug() << "sampleNewVec size:" << sampleNewVec.size();
}
else if (dstTarShapeVec.size() > sampleVec.size())
{
dstTarShapeNewVec.resize(sampleVec.size());
//qDebug() << "dstTarShapeNewVec size: " << dstTarShapeNewVec.size();
LB_Improved filterNew(dstTarShapeNewVec, dstTarShapeNewVec.size() / 50.0);
double dis = filterNew.test(sampleNewVec);
if (disMin > dis) {
disMin = dis;
bestLabel = label;
} }
//qDebug() << "new filter v size: " << filterNew.getVSize(); if (!dataReshapeAndPretreatment(newDataVec, newDstTarShapeVec))
//qDebug() << "disMin: " << disMin; {
continue;
}
if (!dataReshapeAndPretreatment(srcSampleVec, sampleVec))
{
continue;
}
}
else if (srcSampleVec.first().size() > dataVec.first().size())
{
QVector<QVector<double>> newSrcSampleVec;
int minSize = dataVec.first().size();
for (int i = 0; i < srcSampleVec.size(); ++i)
{
QVector<double> subVec = srcSampleVec[i];
subVec.resize(minSize);
newSrcSampleVec.push_back(subVec);
}
if (!dataReshapeAndPretreatment(newSrcSampleVec, sampleVec))
{
continue;
} }
} }
else else
{ {
double dis = filter.test(sampleNewVec); if (!dataReshapeAndPretreatment(srcSampleVec, sampleVec))
{
continue;
}
}
LB_Improved filter(newDstTarShapeVec, newDstTarShapeVec.size() / 50.0);
if (newDstTarShapeVec.size() != sampleVec.size())
{
qWarning() << " newDstTarShapeVec.size != sampleVec.size";
continue;
}
double dis = filter.test(sampleVec);
if (disMin > dis) { if (disMin > dis) {
disMin = dis; disMin = dis;
bestLabel = label; bestLabel = label;
} }
//qDebug() << "disMin: " << disMin; cv::Mat dstTarShapeMatNew(1, newDstTarShapeVec.size(), CV_64FC1, &newDstTarShapeVec[0]);
} cv::Mat dstSampleTarShapeMatNew(1, sampleVec.size(), CV_64FC1, &sampleVec[0]);
// test // test
double val = cv::norm(dstTarShapeMatNew, dstSampleTarShapeMatNew);
/* double val = cv::norm(dstTarShapeMat, dstSampleTarShapeMat); //double val = cv::Mahalanobis(dstTarShapeMatNew, dstSampleTarShapeMatNew);
if (val < globalVal) if (val < globalVal)
{ {
globalVal = val; globalVal = val;
bestLabel = label; bestLabel1 = label;
}*/
}
} }
//double val = valueComparison(reshapedSampleVec, reshapedTarVec); //double val = valueComparison(reshapedSampleVec, reshapedTarVec);
//if (val < globalVal)
//{
// globalVal = val;
// bestLabel1 = label;
//}
}
//mComparedValMapLabel[val] = label; //mComparedValMapLabel[val] = label;
} }
mComparedValMapLabel[disMin] = bestLabel; mComparedValMapLabel[disMin] = bestLabel;
mDisMapLabel[globalVal] = bestLabel1;
qDebug() << "disMin: " << disMin << " bestLabel: " << bestLabel; qDebug() << "disMin: " << disMin << " bestLabel: " << bestLabel;
//qDebug() << "disMin1: " << globalVal << " bestLabel1: " << bestLabel1;
//cv::parallel_for_(cv::Range(0, loopVec.size()), parallelInvoker(this, loopVec, labelLoopVec, reshapedTarVec)); //cv::parallel_for_(cv::Range(0, loopVec.size()), parallelInvoker(this, loopVec, labelLoopVec, reshapedTarVec));
return 1; return 1;
} }
@ -500,9 +523,9 @@ int dataPreProcessing::dataRepeatMatch(int mBoundary,
{ {
qDebug() << "m data:" << dataVec.size(); qDebug() << "m data:" << dataVec.size();
if (dataVec[0].size() <= 0) return -1; if (dataVec[0].size() <= 0) return -1;
int startIndex = 5; int startIndex = 20;
int step = 1; int step = 1;
int win = mBoundary + 5; int win = mBoundary + startIndex;
qWarning() << "I print mBoundary:" << mBoundary; qWarning() << "I print mBoundary:" << mBoundary;
qWarning() << "I print winSize:" << win; qWarning() << "I print winSize:" << win;
qWarning() << "I print sensor data size:" << dataVec[0].size(); qWarning() << "I print sensor data size:" << dataVec[0].size();
@ -527,8 +550,17 @@ int dataPreProcessing::dataRepeatMatch(int mBoundary,
if (mComparedValMapLabel.size() > 0) if (mComparedValMapLabel.size() > 0)
{ {
label = mComparedValMapLabel.first(); label = mComparedValMapLabel.first();
qDebug() << "final bestLabel: " << mComparedValMapLabel.begin().value()
<< " disMin: " << mComparedValMapLabel.begin().key();
} }
//int label1 = -1;
//if (mDisMapLabel.size() > 0)
//{
// label1 = mDisMapLabel.first();
// qDebug() << "final bestLabel1: " << mDisMapLabel.begin().value()
// << " disMin1: " << mDisMapLabel.begin().key();
//}
mDisMapLabel.clear();
mComparedValMapLabel.clear(); mComparedValMapLabel.clear();
return label; return label;
} }
@ -537,7 +569,7 @@ int dataPreProcessing::dataRepeatMatch(QString typeSerial, QString leftRightJudg
{ {
if (m_comDecData.size() <= 0) if (m_comDecData.size() <= 0)
{ {
qDebug() << "com size"; qDebug() << "num com size is empty";
return -1; return -1;
} }

@ -37,7 +37,7 @@ public:
dataPreProcessing(); dataPreProcessing();
~dataPreProcessing(); ~dataPreProcessing();
public: public:
using QStandardnormFileMapLabelSsample = using QStandardnormFileMapLabelSample =
QMap<QString, QMultiMap <int, QMultiMap<QString, QVector<QVector<double>>>>>; QMap<QString, QMultiMap <int, QMultiMap<QString, QVector<QVector<double>>>>>;
void setRawMat(const cv::Mat& rawImage) { void setRawMat(const cv::Mat& rawImage) {
rawMat = rawImage; rawMat = rawImage;
@ -58,12 +58,12 @@ public:
// new version // new version
bool saveWinSize2File(int winSize); bool saveWinSize2File(int winSize);
QStandardnormFileMapLabelSsample getDataStructure() { QStandardnormFileMapLabelSample getDataStructure() {
return m_StandardnormFileMapLabelSsample; return m_StandardnormFileMapLabelSample;
} }
void setDataStructure(const QStandardnormFileMapLabelSsample data) void setDataStructure(const QStandardnormFileMapLabelSample data)
{ {
m_StandardnormFileMapLabelSsample = data; m_StandardnormFileMapLabelSample = data;
} }
bool qstring2stdString(const QString& str, std::string &stdStr); bool qstring2stdString(const QString& str, std::string &stdStr);
bool creatNumFolder(const QString& typeStr); bool creatNumFolder(const QString& typeStr);
@ -96,6 +96,7 @@ public:
void loadedDataReshapeForComparison(const QVector<QVector<double>> & loadedData, QVector<double>& reshapedData); void loadedDataReshapeForComparison(const QVector<QVector<double>> & loadedData, QVector<double>& reshapedData);
double valueComparison(QVector<double> sampleVec, const QVector<double> tarVec); double valueComparison(QVector<double> sampleVec, const QVector<double> tarVec);
QMap<double, int> mComparedValMapLabel; QMap<double, int> mComparedValMapLabel;
QMap<double, int> mDisMapLabel;
void setPredictionDataFromComm(QVector<QVector<double>> _comData) { void setPredictionDataFromComm(QVector<QVector<double>> _comData) {
m_comDecData = _comData; m_comDecData = _comData;
} }
@ -156,7 +157,7 @@ private:
QVector<QVector<double>> m_comDecData; QVector<QVector<double>> m_comDecData;
QString m_szSide; QString m_szSide;
QVector<QString> m_normAndabnormDir; QVector<QString> m_normAndabnormDir;
QStandardnormFileMapLabelSsample m_StandardnormFileMapLabelSsample; QStandardnormFileMapLabelSample m_StandardnormFileMapLabelSample;
QString stationName; QString stationName;
}; };

@ -6,10 +6,16 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>682</width> <width>735</width>
<height>467</height> <height>512</height>
</rect> </rect>
</property> </property>
<property name="maximumSize">
<size>
<width>735</width>
<height>512</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>SmokeBoxIdentification</string> <string>SmokeBoxIdentification</string>
</property> </property>
@ -19,7 +25,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>682</width> <width>735</width>
<height>34</height> <height>34</height>
</rect> </rect>
</property> </property>

Loading…
Cancel
Save