diff --git a/src/algorithm/AlgorithmFluorescence.cpp b/src/algorithm/AlgorithmFluorescence.cpp index 941b92c..c9cbce2 100644 --- a/src/algorithm/AlgorithmFluorescence.cpp +++ b/src/algorithm/AlgorithmFluorescence.cpp @@ -34,6 +34,8 @@ public: bool useHeight; bool useDiameter; QStringList defectList; + double dRatioVal{0}; + int ratioType{ 0 }; }; CAlgorithmFluorescence::CAlgorithmFluorescence(void) @@ -46,9 +48,142 @@ CAlgorithmFluorescence::~CAlgorithmFluorescence(void) } -//cv::BackgroundSubtractorMOG CAlgorithmFluorescence::bgSubtractor(30, 5, 0.95, false); +//检测算法入口函数 由corctl框架回调 +int CAlgorithmFluorescence::IImageAnalysis(class IImageObject* pImgObj, TP_ALGORITHM_OPTION* pOpt, class IDetectorEngine* pDE) +{ + qDebug() << "start alg"; + QMutexLocker locker(&mutex); + + double dStart = cv::getTickCount(); + Mat matSrc = getImage(pImgObj).clone();//获取相机原始图像 + QVariantMap vMap = pImgObj->IVarFromUI().toMap();//获取由UI传递过来的算法参数 + + //解析出模板库指针 这里获取的是整个模块库 + long long modelMapPtr = vMap.value("modelMap").toLongLong(); + QMap *ptr = (QMap*)modelMapPtr; + + //获取需要检测的列表 型号名 + long long defectListPtr = vMap.value("defectList").toLongLong(); + QStringList* strModelListptr = (QStringList*)defectListPtr; + QStringList strModelList; + if(strModelListptr) + strModelList = *(strModelListptr); + int IsCutedImg = vMap.value("IsCutImg", 0).toInt();//裁剪后的轮毂图 检测模式 小图 + + int th = vMap.value("thickness", -1).toInt();//轮毂厚度 轮毂高度数据 + bool useThickness = vMap.value("useThickness", 0).toBool();//是否使用厚度检测判断 匹配时过滤不符合范围的模板 + bool useDiameter = vMap.value("useDiameter", 0).toBool();//是否使用直径参数检测判断 + double dD2H = vMap.value("d2h", -1).toDouble(); + + int nthreshold = vMap.value("Threshold", 15).toInt();//图像阈值参数 使用背景图抠图算法时使用 + bool bUseBackground = vMap.value("useBackground",false).toBool();//true 使用背景图抠图 false 不使用背景 + + int ratioType = vMap.value("RatioType").toInt();//偏距检测模式 启用方式 + double ratioVal = vMap.value("Ratio").toDouble();//偏距系数 + bool bEqual = vMap.value("bEqual").toBool();//使用使用图像增强 + int filterSize = vMap.value("filterSize").toInt();//过滤圆大小 + + if (nthreshold <= 0) + nthreshold = 15; + + QVariantMap rltMap;//算法检测结果值 输出到UI用 + rltMap.insert("ratioVal", ratioVal); + luffy_base::luffyCircle lCircle; + static bool bReload = false;//背景图加载判断 + Mat matBack = getBackGroundImage(pImgObj, bReload);//获取背景图 + + Mat matMatch;//抠图后的图像 目标图像 + if (IsCutedImg == 0) //使用的是原始图像 需要执行圆查找算法找出 轮毂 + { + //原始图像的size和背景图size不匹配, 直接返回错误提示 + if (bUseBackground == true && (matSrc.size().height != matBack.size().height || matSrc.size().width != matBack.size().width)) + { + rltMap.insert("error", 0); + pImgObj->IVariantMapToUI(rltMap); + bReload = true; + return 0; + } + else{ + bReload = false; + } + + if (bUseBackground == true)//使用背景图 做减法找圆 + { + matMatch = ImageProcess::findCircleByBackground(matSrc, matBack, &lCircle); + } + else { + //不需要 背景图找圆算法 + Point2f centerPoint; + double radius = 0; + matMatch = ImageProcess::findCircle(matSrc, centerPoint, radius, bEqual,filterSize); + lCircle.ptCenter = centerPoint; + lCircle.fRadius = radius; + } + if (matMatch.cols >= 900 || matMatch.rows >= 900)//控制检测图像大小不能超过这个范围 + { + cv::resize(matMatch, matMatch, cv::Size(matMatch.cols / 2, matMatch.rows / 2)); + lCircle.fRadius = lCircle.fRadius / 2; + } + } + else{ + matMatch = matSrc; + } + + Result2Ui *pResult = new Result2Ui; + pResult->m_pixSrc = QtCVUtils::cvMatToQPixmap(matSrc);//!>原图像发送值UI 用于保存备份和调试 + if (matMatch.empty())//抠图为空,表示抠图失败,直接返回错误 + { + rltMap.insert("noCircle", 0); + long long varRlt = (long long)pResult; + rltMap.insert("result", varRlt); + pImgObj->IVariantMapToUI(rltMap); + return 0; + } -QString CAlgorithmFluorescence::bestMatch(const QMap* modelMap, CLocalWheel*pLocal, double* pMinDis /*= NULL*/, int minDisNum /*= -1*/) const + double dDiameter = dD2H * lCircle.fRadius * 2;//计算轮毂直径 + //打包相关数据 + CLocalWheel wheelLocal; + wheelLocal.defectList = strModelList; + wheelLocal.img = matMatch.clone(); + wheelLocal.height = th; + wheelLocal.diameter = dDiameter; + wheelLocal.useHeight = useThickness; + wheelLocal.useDiameter = useDiameter; + wheelLocal.ratioType = ratioType; + wheelLocal.dRatioVal = ratioVal; + //开始匹配 + if (!matMatch.empty() && ptr && ptr->size() > 0) { + vector minDisVec(ptr->size());//初始化模板匹配分数值 + QString str = bestMatch(ptr, &wheelLocal, &(minDisVec[0]), minDisVec.size()); + pResult->m_strModel = str; + pResult->m_dMinDis = minDisVec[0]; + if (ptr->contains(str) && ptr->value(str)->getImageComModel()) { + ICompareModel *pModel = ptr->value(str)->getImageComModel(); + double d = pModel->getDisThre(); + double dValue = (d - minDisVec[0]) / d * 0.4 + 0.6; + pResult->m_dScore = dValue; + } + } + + qDebug() << "pull result"; + QImage img = QtCVUtils::cvMatToQImage(matMatch); + pResult->m_pixResult = QtCVUtils::cvMatToQPixmap(matMatch);// .scaled(125, 125); + pResult->m_dDiameter = dDiameter; + pResult->m_dThickness = th; + + //!>传递检测结果到UI + //pImgObj->IDrawImage(img.scaled(300, 300));//!>显示结果图片到UI的第二个窗口上 + double dTime = (cv::getTickCount() - dStart) / cv::getTickFrequency(); + pResult->m_dRunTime = dTime; + long long varRlt = (long long)pResult; + rltMap.insert("result", varRlt); + pImgObj->IVariantMapToUI(rltMap); + qDebug() << "finish alg"; + return 1; +} + +//模板匹配流程 +QString CAlgorithmFluorescence::bestMatch(const QMap* modelMap, CLocalWheel* pLocal, double* pMinDis /*= NULL*/, int minDisNum /*= -1*/) const { double minDis = DBL_MAX; QString bestName; @@ -68,13 +203,13 @@ QString CAlgorithmFluorescence::bestMatch(const QMap* mod if (!modelMap->contains(strModelName)) continue; - QMap::const_iterator itsModel = modelMap->find(strModelName); + QMap::const_iterator itsModel = modelMap->find(strModelName); disVec[nIndex] = DBL_MAX; IWheelModel *pWheel = itsModel.value(); if (!pWheel) break; if (pLocal->useDiameter) { - if (abs(pLocal->diameter-pWheel->getDiameter()) >= 15) { + if (abs(pLocal->diameter - pWheel->getDiameter()) >= 15) { nIndex++; continue; } @@ -85,7 +220,23 @@ QString CAlgorithmFluorescence::bestMatch(const QMap* mod continue; } } - QString name = strModelName;// i.key(); + if (pLocal->ratioType == 1) {//开启使用偏距过滤检测模板的功能 + //必须三个数值不为0才进行 否则可能导致不明问题 + double curRatioVal = pLocal->dRatioVal; + double minRatio = pWheel->getMinRotia(); + double maxRatio = pWheel->getMaxRotia(); + + if (curRatioVal > 0 && minRatio > 0 && maxRatio > 0) + { + if (curRatioVal < minRatio || curRatioVal > maxRatio) + { + nIndex++; + continue; + } + } + } + + QString name = strModelName; ICompareModel* pModel = pWheel->getImageComModel(); if (pModel->getBaseImg().data == NULL) @@ -96,7 +247,7 @@ QString CAlgorithmFluorescence::bestMatch(const QMap* mod pModel->setIsEnableCache(false); - double dis = pModel->compare(pLocal->img, NULL, true, 1); + double dis = pModel->compare(pLocal->img, NULL, true, 1); double disThre = pModel->getDisThre(); double innerCircleNum = pModel->getInnerCircleNum(); if (dis < disThre) @@ -201,187 +352,9 @@ QString CAlgorithmFluorescence::bestMatch(const QMap* mod } } - //if (similarNum == 1) - //{ - // double dis = std::fabs(innerCircleNumSum - simularModelMap.begin().value()); - // if (dis > INSIDE_NUM_DIS_THRE) - // { - // bestName = QString(); - // } - //} - //if (similarNum > 1) - //{ - // auto iterEnd = simularModelMap.constEnd(); - // double disMin = DBL_MAX; - - // for (auto iter = simularModelMap.constBegin(); iter != iterEnd; ++iter) - // { - // double dis = std::fabs(innerCircleNumSum - iter.value()); - // if (dis < disMin) - // { - // disMin = dis; - // bestName = iter.key(); - // } - // } - - //} - - //auto iterEnd = simularModelMap.constEnd(); - //bool bestMatchFlag = false; - //for (auto iter = simularModelMap.constBegin(); iter != iterEnd; ++iter) - //{ - // double dis = std::fabs(innerCircleNumSum - iter.value()); - // if (dis < INSIDE_NUM_DIS_THRE) - // { - // bestName = iter.key(); - // bestMatchFlag = true; - // break; - // } - //} - //if (!bestMatchFlag) - //{ - // bestName = QString(); - //} - return bestName; } -int CAlgorithmFluorescence::IImageAnalysis(class IImageObject* pImgObj, TP_ALGORITHM_OPTION* pOpt, class IDetectorEngine* pDE) -{ - QMutexLocker locker(&mutex); - qDebug() << "start alg"; - double dStart = cv::getTickCount(); - Mat matSrc = getImage(pImgObj).clone(); - QVariantMap vMap = pImgObj->IVarFromUI().toMap(); - - long long modelMapPtr = vMap.value("modelMap").toLongLong(); - QMap *ptr = (QMap*)modelMapPtr; - - long long defectListPtr = vMap.value("defectList").toLongLong(); - - QStringList* strModelListptr = (QStringList*)defectListPtr; - QStringList strModelList; - if(strModelListptr) - strModelList = *(strModelListptr); - - int th = vMap.value("thickness", -1).toInt(); - bool useThickness = vMap.value("useThickness", 0).toBool(); - bool useDiameter = vMap.value("useDiameter", 0).toBool(); - double dD2H = vMap.value("d2h", -1).toDouble(); - int nthreshold = vMap.value("Threshold", 15).toInt(); - bool bUseBackground = vMap.value("useBackground",false).toBool();//true 使用背景图抠图 false 不使用背景 - - if (nthreshold <= 0) - nthreshold = 15; - int IsCutedImg = vMap.value("IsCutImg", 0).toInt();//裁剪后的轮毂图 - QVariantMap rltMap; - luffy_base::luffyCircle lCircle; - static bool bReload = false; - Mat matBack = getBackGroundImage(pImgObj, bReload);//获取背景图 - Mat matMatch;//装载抠图后的图像 - if (IsCutedImg == 0){ - if (bUseBackground == true && (matSrc.size().height != matBack.size().height || matSrc.size().width != matBack.size().width)) - { - rltMap.insert("error", 0); - pImgObj->IVariantMapToUI(rltMap); - bReload = true; - return 0; - } - else{ - bReload = false; - } - //imageSegementation(matSrc); - //matMatch = ImageProcess::findCircleObject(matSrc, matBack, bUseBackground, nthreshold/*15*/, &lCircle/* NULL*/); - Point2f centerPoint; - double radius = 0; - matMatch = ImageProcess::findCircle(matSrc, centerPoint, radius, bUseBackground); - lCircle.ptCenter = centerPoint; - lCircle.fRadius = radius; - - if (matMatch.cols >= 900 || matMatch.rows >= 900) - { - - cv::resize(matMatch, matMatch, cv::Size(matMatch.cols / 2, matMatch.rows / 2)); - lCircle.fRadius = lCircle.fRadius / 2; - } - } - else{ - matMatch = matSrc; - } - - Result2Ui *pResult = new Result2Ui; - pResult->m_pixSrc = QtCVUtils::cvMatToQPixmap(matSrc);//!>原图像发送值UI 用于保存备份和调试 - if (matMatch.empty()) - { - rltMap.insert("noCircle", 0); - long long varRlt = (long long)pResult; - rltMap.insert("result", varRlt); - pImgObj->IVariantMapToUI(rltMap); - return 0; - } - - double dDiameter = dD2H * lCircle.fRadius * 2; - - CLocalWheel wheelLocal; - wheelLocal.defectList = strModelList; - wheelLocal.img = matMatch.clone(); - wheelLocal.height = th; - wheelLocal.diameter = dDiameter; - wheelLocal.useHeight = useThickness; - wheelLocal.useDiameter = useDiameter; - - if (!matMatch.empty() && ptr && ptr->size() > 0) { - vector minDisVec(ptr->size()); - qDebug() << "start bestMatch"; - QString str = bestMatch(ptr, &wheelLocal, &(minDisVec[0]), minDisVec.size()); - qDebug() << "end bestMatch"; - pResult->m_strModel = str; - pResult->m_dMinDis = minDisVec[0]; - if (ptr->contains(str) && ptr->value(str)->getImageComModel()) { - ICompareModel *pModel = ptr->value(str)->getImageComModel(); - double d = pModel->getDisThre(); - double dValue = (d - minDisVec[0]) / d * 0.4 + 0.6; - pResult->m_dScore = dValue; - } - } - else if (matMatch.empty()) - { - - } - qDebug() << "pull result"; - QImage img = QtCVUtils::cvMatToQImage(matMatch); - pResult->m_pixResult = QtCVUtils::cvMatToQPixmap(matMatch);// .scaled(125, 125); - pResult->m_dDiameter = dDiameter; - pResult->m_dThickness = th; - - //!>传递检测结果到UI - //pImgObj->IDrawImage(img.scaled(300, 300));//!>显示结果图片到UI的第二个窗口上 - double dTime = (cv::getTickCount() - dStart) / cv::getTickFrequency(); - pResult->m_dRunTime = dTime; - long long varRlt = (long long)pResult; - rltMap.insert("result", varRlt); - pImgObj->IVariantMapToUI(rltMap); - qDebug() << "finish alg"; - return 1; -} - -QStringList *CAlgorithmFluorescence::getDefectListPtr(class IImageObject *pImgObj) -{ - return nullptr; -// IAlgorithmShared *pShare = pImgObj->IGetShared(); -// int nMap = pShare->IGetInt("defectList"); -// return (QStringList*)nMap; -} - -QMap *CAlgorithmFluorescence::getWheelMapPtr(class IImageObject *pImgObj) -{ -// IAlgorithmShared *pShare = pImgObj->IGetShared(); -// if (!pShare) -// return nullptr; -// int nMap = pShare->IGetInt("modelMap"); -// return (QMap*)nMap; - return nullptr; -} cv::Mat CAlgorithmFluorescence::getImage(class IImageObject *pImgObj) { @@ -409,13 +382,11 @@ cv::Mat CAlgorithmFluorescence::getBackGroundImage(class IImageObject *pObj, boo { static Mat matback; if (matback.empty()) { - QString filepath = /*getPath(pObj) +*/ ".\\user\\background.png"; + QString filepath = ".\\user\\background.png"; matback = cv::imread(string((const char *)filepath.toLocal8Bit()), 0); - //matback = cv::imread(filepath.toLatin1().data(), 0); if (matback.empty()) { QString filepath = getPath(pObj) + "\\user\\background_r.png"; matback = cv::imread(string((const char *)filepath.toLocal8Bit()), 0); - //matback = cv::imread(filepath.toLatin1().data(), 0); cv::flip(matback, matback, 1); } } @@ -426,7 +397,6 @@ cv::Mat CAlgorithmFluorescence::getBackGroundImage(class IImageObject *pObj, boo if (matback.empty()) { QString filepath = getPath(pObj) + "\\user\\background_r.png"; matback = cv::imread(string((const char *)filepath.toLocal8Bit()), 0); - //matback = cv::imread(filepath.toLatin1().data(), 0); cv::flip(matback, matback, 1); } } @@ -445,69 +415,3 @@ QString CAlgorithmFluorescence::getPath(class IImageObject *pObj) } return mlist.first(); } - -//void CAlgorithmFluorescence::imageSegementation(const cv::Mat &srcImage) -//{ -// Mat mask; -// //Mat sobelImg = srcImage.clone(); -// //genSobelImage(sobelImg); -// //sobelImg.convertTo(sobelImg, CV_8UC1); -// -// -// Mat sobelX, sobelY; -// Sobel(srcImage, sobelX, CV_32FC1, 1, 0, 3, BORDER_REPLICATE); -// Sobel(srcImage, sobelY, CV_32FC1, 0, 1, 3, BORDER_REPLICATE); -// Mat img = sobelX.mul(sobelX) + sobelY.mul(sobelY); -// Mat tempImg; -// img.convertTo(tempImg, CV_32FC1); -// Mat tempImg0; -// sqrt(tempImg, tempImg0); -// img = tempImg0; -// img.convertTo(img, CV_8UC1); -// Mat blurImg; -// cv::medianBlur(img, blurImg, 11); -// bgSubtractor(img, mask, 0.001); -// -// /*cv::Mat element5(5, 5, CV_8U, cv::Scalar(1)); -// cv::Mat closedMat; -// cv::morphologyEx(mask, closedMat, cv::MORPH_CLOSE, element5);*/ -// -// //cv::floodFill(); -// luffy_base::luffyCircle pCircle; -// -// vector mats= ImageProcess::findCircleObject(mask, srcImage, 15, &pCircle); -// if (mats.size() == 0) -// { -// return; -// } -// if (mats[0].size() != mats[1].size()) -// { -// return; -// } -// Mat dilatedImgBin; -// Mat imgBinary = mats[0] > 0; -// dilate(imgBinary, dilatedImgBin, Mat::ones(5, 5, CV_32FC1)); -// erode(dilatedImgBin, imgBinary, Mat::ones(5, 5, CV_32FC1)); -// imgBinary = ~imgBinary; -// //Mat canvas(imgBinary.size(), imgBinary.type(), Scalar::all(0)); -// vector> cons; -// cv::findContours(imgBinary, cons, RETR_EXTERNAL, CHAIN_APPROX_NONE); -// for (const vector & pContour : cons) -// { -// const int& size = pContour.size(); -// if (size < 200) -// { -// Mat(pContour).setTo(255); -// //continue; -// } -// //cv::fillPoly(canvas, vector>(1, pContour), Scalar(255)); -// } -// //Mat tarMat = (~canvas).mul(mats[1]) / 255; -// //openOper(imgBinary, Mat::ones(1, 13, CV_32FC1)); -// -// -// -// -// return; -// -//} diff --git a/src/algorithm/AlgorithmFluorescence.h b/src/algorithm/AlgorithmFluorescence.h index 754baf3..08f08b0 100644 --- a/src/algorithm/AlgorithmFluorescence.h +++ b/src/algorithm/AlgorithmFluorescence.h @@ -28,16 +28,13 @@ class CAlgorithmFluorescence : public IAlgorithm public: CAlgorithmFluorescence(void); virtual ~CAlgorithmFluorescence(void); - //void imageSegementation(const cv::Mat &srcImage); - //static cv::BackgroundSubtractorMOG bgSubtractor; -private: + virtual int IImageAnalysis(class IImageObject* pImgObj, TP_ALGORITHM_OPTION* pOpt, class IDetectorEngine* pDE); +private: QString bestMatch(const QMap* modelMap, CLocalWheel*pLocal, double* pMinDis /*= NULL*/, int minDisNum /*= -1*/) const; - QMap *getWheelMapPtr(class IImageObject *pObj); QString getPath(class IImageObject *pObj); cv::Mat getImage(class IImageObject *pObj); cv::Mat getBackGroundImage(class IImageObject *pObj, bool bReLoad = false); - QStringList *getDefectListPtr(class IImageObject *pImgObj); QMutex mutex; }; diff --git a/src/algorithm/ImageProcess.cpp b/src/algorithm/ImageProcess.cpp index d6f24fc..cb4e241 100644 --- a/src/algorithm/ImageProcess.cpp +++ b/src/algorithm/ImageProcess.cpp @@ -44,6 +44,7 @@ Mat findEdge2(const Mat &Src) return ret; } #define REAIZE 2 +//老算法 准确率低 cv::Mat ImageProcess::findCircleObject(const Mat &src, const Mat& backgroundImg, bool useBackgroundFlag, int nThres /*= 20*/, luffy_base::luffyCircle *pCircle /*= NULL*/) { #ifdef MOTO_DETECT//摩轮型号识别抠图算法 @@ -53,7 +54,6 @@ cv::Mat ImageProcess::findCircleObject(const Mat &src, const Mat& backgroundImg, cv::resize(src, detectImg, cv::Size(src.cols / REAIZE, src.rows / REAIZE)); int bBaseX = detectImg.cols; int bBaseY = detectImg.rows; - //if (nThres<=1) equalizeHist(detectImg, detectImg); detectImg = _EnhanImg_sharpen(detectImg); @@ -654,7 +654,7 @@ Mat ImageProcess::DetectCircle(Mat img, Point2f& center, double& radius, bool bE CircleDetector cd; cd.setAlgoType(CircleDetector::PeakCircle); - cd.setEdgeWidth(3); + cd.setEdgeWidth(6); cd.setPolarity(Polarity::White2Black); cd.setFindBy(FindBy::Best); double difRadiusMin = radius - 100; @@ -692,4 +692,50 @@ Mat ImageProcess::DetectCircle(Mat img, Point2f& center, double& radius, bool bE center = cen; radius = r; return s; +} + +//使用背景图做减法扣圆 +cv::Mat ImageProcess::findCircleByBackground(const Mat &src, const Mat& backgroundImg, luffy_base::luffyCircle *pCircle /*= NULL*/) +{ + if (src.empty() || backgroundImg.empty() || src.rows < 500) { + return Mat(); + } + assert(backgroundImg.type() == CV_8UC1); + Mat imgTmp = src; + Mat foregroundImg = getForeImage(imgTmp, backgroundImg); + + CircleDetector cd; + cd.setAlgoType(CircleDetector::PeakCircle); + cd.setEdgeWidth(6); + cd.setPolarity(Polarity::White2Black); + cd.setFindBy(FindBy::Best); + double difRadiusMin = 0; + double difRadiusMax = (foregroundImg.cols>foregroundImg.rows? foregroundImg.rows/2 : foregroundImg.cols/2)-50; + cd.setRadii(difRadiusMin, difRadiusMax); + cd.setACThres(3); + vector allScores; + Vec3f bestCircle; + float bestScore = cd.detectBest(foregroundImg, Point2f(imgTmp.cols/2, imgTmp.rows/2), bestCircle, &allScores); + if (abs(bestScore) <= FLT_EPSILON || bestCircle == Vec3f::zeros()) { + return Mat(); + } + + Point2f cen(bestCircle[0], bestCircle[1]); + double r = bestCircle[2]; + Rect rect; + rect.x = cen.x - r; + rect.y = cen.y - r; + if (rect.x < 0) + rect.x = 0; + if (rect.y < 0) + rect.y = 0; + rect.width = 2 * r; + rect.height = 2 * r; + Mat rltMat = src(rect); + if (pCircle) + { + pCircle->fRadius = r; + pCircle->ptCenter = cen; + } + return rltMat; } \ No newline at end of file diff --git a/src/algorithm/ImageProcess.h b/src/algorithm/ImageProcess.h index dd81fd9..101b617 100644 --- a/src/algorithm/ImageProcess.h +++ b/src/algorithm/ImageProcess.h @@ -23,10 +23,9 @@ public: static cv::Mat findCircleObject(const Mat &src, const Mat& backgroundImg, bool useBackgroundFlag, int nThres = 20, luffy_base::luffyCircle *pCircle = NULL); static cv::Mat getForeImage(const Mat & src, const Mat &backgroundImg); - static cv::Mat findCircle(const Mat &srcImg, Point2f& center, double &radius, bool bEqual, int filterSize=50);//找圆 static cv::Mat DetectCircle(Mat img, Point2f& center, double& radius, bool bEqual);//精细找圆 - + static cv::Mat findCircleByBackground(const Mat &src, const Mat& backgroundImg, luffy_base::luffyCircle *pCircle /*= NULL*/); }; #endif diff --git a/src/interface/IWheelModel.h b/src/interface/IWheelModel.h index 864ab67..a67ecde 100644 --- a/src/interface/IWheelModel.h +++ b/src/interface/IWheelModel.h @@ -5,6 +5,7 @@ class TempImage; class ICompareModel; //extern int nGlobalMinImgs = 10; +/*模板型号接口文件*/ class IWheelModel { public: @@ -28,7 +29,7 @@ public: virtual QString getPicPath() const = 0; virtual void setPicPath(QString str) = 0; - virtual ICompareModel *getImageComModel() const = 0; + virtual ICompareModel *getImageComModel() const = 0;//获取模板算法模型 virtual void setImageComModel(ICompareModel *) = 0; virtual TempImage *getTempImage() const = 0; virtual bool initTmpImage(const QString&) = 0; @@ -37,9 +38,11 @@ public: virtual int getImageModel() const = 0; virtual int getImgCount() const = 0; virtual bool getAddTrainFlag()const = 0; - virtual void setTrainFlag(bool bFlag) = 0; -private: - + virtual void setTrainFlag(bool bFlag) = 0;//是否训练 + virtual double getMinRotia() const = 0;//获取最小系数 + virtual double getMaxRotia() const = 0;//获取最大系数 + virtual void setMinRotia(double val) = 0;//设置最小系数 + virtual void setMaxRotia(double val) = 0;//设置最大系数 }; #endif diff --git a/src/tpMain/ComConfig.h b/src/tpMain/ComConfig.h index bd2dd6e..a354fb9 100644 --- a/src/tpMain/ComConfig.h +++ b/src/tpMain/ComConfig.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef _COMCONFIG_H_ +#define _COMCONFIG_H_ #include "QString" class ComConfig { @@ -17,3 +18,4 @@ private: QString appPath; }; +#endif diff --git a/src/tpMain/DetectState.cpp b/src/tpMain/DetectState.cpp index c3b7218..277acc4 100644 --- a/src/tpMain/DetectState.cpp +++ b/src/tpMain/DetectState.cpp @@ -43,6 +43,9 @@ void DetectState::init(QString strPath) if (!algObj.isEmpty()) { m_AlgThres = algObj.value("Threshold").toInt(15); + m_RatioDetectType = algObj.value("RatioType").toInt(0); + m_bUseEqual = algObj.value("bEqual").toBool(false);//使用使用图像增强 + m_filterSize = algObj.value("filterSize").toInt(50);//过滤圆大小 } else { m_AlgThres = 15; @@ -234,7 +237,12 @@ void DetectState::saveDeteImage() autosystemobj.insert("showThressList", m_showThressList); jsMyself.insert(WHEEL_SELFDEFINE_AUTOITEM, autosystemobj); - + QJsonObject algObj; + algObj.insert("Threshold", m_AlgThres); + algObj.insert("RatioType", m_RatioDetectType); + algObj.insert("bEqual", m_bUseEqual);//使用使用图像增强 + algObj.insert("filterSize", m_filterSize);//过滤圆大小 + jsMyself.insert(WHEEL_SELFDEFINE_ALGPARA, algObj); QZkJsonParser::WriteJsonObject(fileMyself, jsMyself); } @@ -268,6 +276,9 @@ void DetectState::save() QJsonObject algObj; algObj.insert("Threshold", m_AlgThres); + algObj.insert("RatioType", m_RatioDetectType); + algObj.insert("bEqual",m_bUseEqual);//使用使用图像增强 + algObj.insert("filterSize",m_filterSize);//过滤圆大小 jsMyself.insert(WHEEL_SELFDEFINE_ALGPARA, algObj); QZkJsonParser::WriteJsonObject(fileMyself, jsMyself); } diff --git a/src/tpMain/DetectState.h b/src/tpMain/DetectState.h index 0334254..a5d40d1 100644 --- a/src/tpMain/DetectState.h +++ b/src/tpMain/DetectState.h @@ -23,7 +23,7 @@ public: int totalUnDetectNum; //无匹配数量 int m_IsUseRaster;//是否使用光栅标志 0 表示不使用 1 表示使用 光栅485通信// int m_SaveD2HCsv;//保存厚度数据信息 - int m_IsUseChannel; + int m_IsUseChannel{0}; int m_StartAndDetect; int m_CameraTrigeType;//0 表示使用相机内触发模式 1表示使用传感器触发相机模式 @@ -78,6 +78,10 @@ public: int m_UseCutImg; int m_UseBackground{0}; bool bLockDetect{ false }; + + int m_RatioDetectType{ 0 };//偏距检测模式: 0 不启用, 1 检测使用偏距过滤 ,2 结果使用偏距过滤 + bool m_bUseEqual{ false };//是否使用图像增强 + int m_filterSize{ 50 };//过滤圆大小 }; #endif diff --git a/src/tpMain/ModelManager.cpp b/src/tpMain/ModelManager.cpp index 1435e39..8bacf3b 100644 --- a/src/tpMain/ModelManager.cpp +++ b/src/tpMain/ModelManager.cpp @@ -5,16 +5,16 @@ #include "WheelModel.h" #include "modelmgrdb.h" -#define WHEEL_MODEL_FILE "\\user\\model.json" +#define WHEEL_MODEL_FILE "\\pattern\\model.json" #define WHEEL_DB_FILE "\\pattern\\modelTemplate.db" #pragma execution_character_set("utf-8") ModelManager::ModelManager(QString strRoot) : m_strRoot(strRoot) { - m_pModelDB = new ModelMgrDB(strRoot + WHEEL_DB_FILE); hubBase::mkdir(m_strRoot + "\\pattern\\"); hubBase::mkdir(m_strRoot + "\\pattern\\template\\"); hubBase::mkdir(m_strRoot + "\\pattern\\Models\\"); + m_pModelDB = new ModelMgrDB(strRoot + WHEEL_DB_FILE); } ModelManager::~ModelManager() diff --git a/src/tpMain/ModelTrain.cpp b/src/tpMain/ModelTrain.cpp index 65f935c..afe9e2d 100644 --- a/src/tpMain/ModelTrain.cpp +++ b/src/tpMain/ModelTrain.cpp @@ -3,7 +3,6 @@ #include "qstring.h" #include "opencv\cv.h" #include "opencv\highgui.h" -//#include "ImageProcess.h" #include "qfile.h" #include "qiodevice.h" #include "qstringlist.h" @@ -20,20 +19,11 @@ ModelTrain::~ModelTrain() { } -// cv::Mat ModelTrain::findCircleObject(QString strPath, int nThres /*= 20*/, luffy_base::luffyCircle *pCircle /*= NULL*/) -// { -// //cv::Mat src = cv::imread(strPath.toLatin1().data(), 0); -// cv::Mat src = cv::imread(std::string((const char*)strPath.toLocal8Bit()), 0); -// cv::Mat back = ModelTrain::getBackGoundImage(); -// return ImageProcess::findCircleObject(src, back, nThres, pCircle); -// } - cv::Mat ModelTrain::getBackGoundImage() { static cv::Mat matback; if (matback.empty()){ QString filepath = qApp->applicationDirPath() + "\\user\\background.png"; - //matback = cv::imread(filepath.toLatin1().data(), 0); matback = cv::imread(std::string((const char*)filepath.toLocal8Bit()), 0); } return matback; diff --git a/src/tpMain/ModelTrain.h b/src/tpMain/ModelTrain.h index fa83d41..fe37829 100644 --- a/src/tpMain/ModelTrain.h +++ b/src/tpMain/ModelTrain.h @@ -1,6 +1,5 @@ #pragma once #include "cv.h" -//#include "Luffy.h" #include "qstring.h" class ModelTrain { @@ -8,7 +7,6 @@ public: ModelTrain(); ~ModelTrain(); static cv::Mat getBackGoundImage(); - //static cv::Mat findCircleObject(QString strPath, int nThres = 20, luffy_base::luffyCircle *pCircle = NULL); bool caliDiameter2Thickness(float &a, float &b); private: }; diff --git a/src/tpMain/TempImage.cpp b/src/tpMain/TempImage.cpp index 420d769..9e82db1 100644 --- a/src/tpMain/TempImage.cpp +++ b/src/tpMain/TempImage.cpp @@ -88,14 +88,6 @@ std::vector TempImage::getVectors() void TempImage::remove(const QString& strKey) { -// for (int i = 0; i < m_imgTemplateLib.size(); i++) { -// if (m_imgTemplateLib.at(i)->m_strFileName == strKey) { -// hubBase::removeFile(m_imgTemplateLib.at(i)->m_strAbsoluteFilePath); -// TempImageInfo * pTemp = m_imgTemplateLib.at(i); -// m_imgTemplateLib.erase(pTemp); -// break; -// } -// } for (std::vector::iterator its = m_imgTemplateLib.begin(); its != m_imgTemplateLib.end(); ++its){ if ((*its)->m_strFileName == strKey){ TempImageInfo* pTemp = (*its); diff --git a/src/tpMain/WheelModel.cpp b/src/tpMain/WheelModel.cpp index 23a3df3..2454dcc 100644 --- a/src/tpMain/WheelModel.cpp +++ b/src/tpMain/WheelModel.cpp @@ -1,7 +1,9 @@ #include "WheelModel.h" #include "TempImage.h" #include "ImageCompareModel.h" -#include "qjsonobject.h" +#include +#include + #pragma execution_character_set("utf-8") enum TEM_MODEL{ emTypeModelSuccess = 0, @@ -88,6 +90,8 @@ void WheelModel::readJson(QJsonObject *pJson) m_passageway = obj.value("channel").toInt(); bDetect = obj.value("detect").toBool(); m_bAddTrain = obj.value("addTrain").toBool(true); + m_minRotia = obj.value("minRotia").toDouble();//最小系数 + m_maxRotia = obj.value("maxRotia").toDouble();//最大系数 } } @@ -100,6 +104,8 @@ void WheelModel::saveJson(class QJsonObject *pJson) obj.insert("channel", m_passageway); obj.insert("detect", bDetect); obj.insert("addTrain", m_bAddTrain); + obj.insert("minRotia", m_minRotia);//最小系数 + obj.insert("maxRotia", m_maxRotia);//最大系数 pJson->insert(m_strModelID, obj); } diff --git a/src/tpMain/WheelModel.h b/src/tpMain/WheelModel.h index 6f9db81..d3d6bd5 100644 --- a/src/tpMain/WheelModel.h +++ b/src/tpMain/WheelModel.h @@ -41,6 +41,11 @@ public: virtual int getImgCount() const; virtual bool getAddTrainFlag()const { return m_bAddTrain; } virtual void setTrainFlag(bool bFlag) { m_bAddTrain = bFlag; } + + virtual double getMinRotia() const { return m_minRotia; } + virtual double getMaxRotia() const { return m_maxRotia; } + virtual void setMinRotia(double val) { m_minRotia = val; } + virtual void setMaxRotia(double val) { m_maxRotia = val; } public: QString m_strModelID; double m_dHeight; //mm 厚度 @@ -55,6 +60,9 @@ public: class ChannelInfo *m_pChannelInfo; class TempImage *m_pTempImage; class ICompareModel *m_pDetectModel; + + double m_minRotia{ 0.0 };//最小系数 + double m_maxRotia{ 0.0 };//最大系数 }; #endif diff --git a/src/tpMain/WheelNet.cpp b/src/tpMain/WheelNet.cpp index 306ffe8..8aae5f7 100644 --- a/src/tpMain/WheelNet.cpp +++ b/src/tpMain/WheelNet.cpp @@ -358,7 +358,10 @@ Q_SLOT void CWheelNet::DataRecvByte(QByteArray m_data) { //PLC触发相机 主动上报 qWarning() << "recv a camera triger time:" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss zzz") << ";"; - emit sgCameraTrig(lstData.at(0));// 第几个 索引 + int hData = lstData.at(1); + int lData = lstData.at(2); + double dRatio = hData + lData * 1.0 / 1000; + emit sgCameraTrig(lstData.at(0), dRatio);// 第几个 索引 } break; case emTypeClear: diff --git a/src/tpMain/WheelNet.h b/src/tpMain/WheelNet.h index 5eba4ab..4e808fa 100644 --- a/src/tpMain/WheelNet.h +++ b/src/tpMain/WheelNet.h @@ -62,7 +62,7 @@ signals: void sgDeteState(bool);//发送离线时的检测状态的应答 void sgChangeOnlineState(int);//强制改变离线、在线状态 void sgRecvDetectState(int nIndex, int value);//在线时接收检测状态 - void sgCameraTrig(int);//PLC触发相机时主动上报 + void sgCameraTrig(int,double);//PLC触发相机时主动上报 void sgShow2UI(QString str, bool bConnect); void sgClientConnect(QString addr, bool bConnect); void sgServerState(QString, int, bool);//用来传送server打开 关闭状态 diff --git a/src/tpMain/qworkItemdlg.ui b/src/tpMain/qworkItemdlg.ui index 860bae4..fa56167 100644 --- a/src/tpMain/qworkItemdlg.ui +++ b/src/tpMain/qworkItemdlg.ui @@ -6,8 +6,8 @@ 0 0 - 203 - 166 + 339 + 213 @@ -20,6 +20,11 @@ + + + 12 + + 确定 @@ -40,13 +45,24 @@ + + + 12 + + 取消 - + + + + 12 + + + @@ -56,6 +72,11 @@ 40 + + + 12 + + 备注信息: @@ -65,6 +86,11 @@ + + + 12 + + 名称: @@ -74,7 +100,13 @@ - + + + + 12 + + + diff --git a/src/tpMain/qworkmgrui.cpp b/src/tpMain/qworkmgrui.cpp index 4f21dd8..0e01a55 100644 --- a/src/tpMain/qworkmgrui.cpp +++ b/src/tpMain/qworkmgrui.cpp @@ -18,7 +18,7 @@ #include "qworkItemdlg.h" #include #pragma execution_character_set("utf-8") - +/*工作任务表配置页面 用于选择当天需要检测的型号列表*/ QWorkMgrUI::QWorkMgrUI(QWorkMgrCtlr *pWork, IWheelCtrl *pCtrl) : m_pCtrl(pCtrl), m_pWorkCtrl(pWork), ptrModel(NULL), tableModel(NULL) { diff --git a/src/tpMain/qworkmgrui.ui b/src/tpMain/qworkmgrui.ui index 6479ee4..d48ac4d 100644 --- a/src/tpMain/qworkmgrui.ui +++ b/src/tpMain/qworkmgrui.ui @@ -16,7 +16,7 @@ - QWorkMgrUI + 检测配置任务表 @@ -107,7 +107,7 @@ - 11 + 12 @@ -118,7 +118,7 @@ - 11 + 12 @@ -133,7 +133,7 @@ - 11 + 12 @@ -148,7 +148,7 @@ - 11 + 12 @@ -163,7 +163,7 @@ - 11 + 12 @@ -198,7 +198,7 @@ - 11 + 12 @@ -211,6 +211,11 @@ false + + + 12 + + @@ -225,7 +230,7 @@ - 11 + 12 @@ -234,7 +239,7 @@ - 11 + 12 @@ -336,7 +341,7 @@ - 1 + 0 @@ -353,7 +358,7 @@ - 11 + 12 @@ -371,7 +376,7 @@ - 11 + 12 @@ -389,7 +394,7 @@ - 11 + 12 @@ -420,6 +425,11 @@ 0 + + + 12 + + @@ -443,7 +453,7 @@ - 11 + 12 @@ -452,7 +462,7 @@ - 11 + 12 diff --git a/tpvs17/tpMain/QAlgParamDlg.cpp b/tpvs17/tpMain/QAlgParamDlg.cpp new file mode 100644 index 0000000..93ae4cf --- /dev/null +++ b/tpvs17/tpMain/QAlgParamDlg.cpp @@ -0,0 +1,11 @@ +#include "QAlgParamDlg.h" + +QAlgParamDlg::QAlgParamDlg(QWidget *parent) + : QWidget(parent) +{ + ui.setupUi(this); +} + +QAlgParamDlg::~QAlgParamDlg() +{ +} diff --git a/tpvs17/tpMain/QAlgParamDlg.h b/tpvs17/tpMain/QAlgParamDlg.h new file mode 100644 index 0000000..8439a67 --- /dev/null +++ b/tpvs17/tpMain/QAlgParamDlg.h @@ -0,0 +1,19 @@ +#ifndef _QALGPARAMDLG_H_ +#define _QALGPARAMDLG_H_ + +#include +#include "ui_QAlgParamDlg.h" + +class QAlgParamDlg : public QWidget +{ + Q_OBJECT + +public: + QAlgParamDlg(QWidget *parent = Q_NULLPTR); + ~QAlgParamDlg(); + +private: + Ui::QAlgParamDlg ui; +}; + +#endif diff --git a/tpvs17/tpMain/QAlgParamDlg.ui b/tpvs17/tpMain/QAlgParamDlg.ui new file mode 100644 index 0000000..baacb38 --- /dev/null +++ b/tpvs17/tpMain/QAlgParamDlg.ui @@ -0,0 +1,59 @@ + + + QAlgParamDlg + + + + 0 + 0 + 624 + 429 + + + + 算法参数设置 + + + + + 30 + 40 + 91 + 16 + + + + 是否使用偏距 + + + + + + 30 + 70 + 54 + 12 + + + + TextLabel + + + + + + 30 + 100 + 54 + 12 + + + + TextLabel + + + + + + + diff --git a/tpvs17/tpMain/QCamSettingDlg.ui b/tpvs17/tpMain/QCamSettingDlg.ui index 5569d50..c397454 100644 --- a/tpvs17/tpMain/QCamSettingDlg.ui +++ b/tpvs17/tpMain/QCamSettingDlg.ui @@ -23,7 +23,7 @@ - background-color: rgb(130, 136, 255); + background-color: rgb(202, 202, 202); diff --git a/tpvs17/tpMain/QModelMgrDlg.cpp b/tpvs17/tpMain/QModelMgrDlg.cpp index 3882c0b..8f5f381 100644 --- a/tpvs17/tpMain/QModelMgrDlg.cpp +++ b/tpvs17/tpMain/QModelMgrDlg.cpp @@ -85,6 +85,9 @@ QModelMgrDlg::QModelMgrDlg(IWheelCtrl *ptr, QWidget *parent) QRegExp regExpNum("((6553[0-5])|[655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])"); ui.ModelMgr_model_edit_height->setValidator(new QRegExpValidator(regExpNum, this)); ui.ModelMgr_model_edit_diameter->setValidator(new QRegExpValidator(regExpNum, this)); +// QRegExp doubleRegExp("^\d+(\.\d+)?$"); +// ui.lineEdit_minRatio->setValidator(new QRegExpValidator(doubleRegExp, this)); +// ui.lineEdit_maxRatio->setValidator(new QRegExpValidator(doubleRegExp, this)); } ui.m_pbDelAll->setVisible(false); @@ -198,6 +201,9 @@ Q_SLOT void QModelMgrDlg::onModifyModel() } pModel->setThickness(ui.ModelMgr_model_edit_height->text().toDouble()); pModel->setDiameter(ui.ModelMgr_model_edit_diameter->text().toDouble()); + pModel->setMinRotia(ui.doubleSpinBox_min->value()); + pModel->setMaxRotia(ui.doubleSpinBox_max->value()); + bool trainFlag = ui.checkBox->isChecked(); pModel->setTrainFlag(trainFlag); if (trainFlag == false) @@ -206,7 +212,6 @@ Q_SLOT void QModelMgrDlg::onModifyModel() emit sgModifyModel(strModel); } - double thisvalue = pModel->getImageComModel()->getDisThre(); double falsMinDis = pModel->getImageComModel()->getFalseSampleMinDis(); double disMax = pModel->getImageComModel()->getDisMax(); @@ -515,6 +520,9 @@ Q_SLOT void QModelMgrDlg::onShowModelInfo(QString str) ui.ModelMgr_model_edit->setText(m_pModelMgr->getModel(str)->getModelID()); ui.ModelMgr_model_edit_diameter->setText(QString::number(m_pModelMgr->getModel(str)->getDiameter())); ui.ModelMgr_model_edit_height->setText(QString::number(m_pModelMgr->getModel(str)->getThickness())); + ui.doubleSpinBox_min->setValue(m_pModelMgr->getModel(str)->getMinRotia()); + ui.doubleSpinBox_max->setValue(m_pModelMgr->getModel(str)->getMaxRotia()); + ui.checkBox->setChecked(m_pModelMgr->getModel(str)->getAddTrainFlag()); double disThred = m_pModelMgr->getModel(str)->getImageComModel()->getDisThre(); @@ -608,6 +616,8 @@ void QModelMgrDlg::onClearShow() ui.ModelMgr_model_edit->setText(""); ui.ModelMgr_model_edit_diameter->setText(""); ui.ModelMgr_model_edit_height->setText(""); + ui.doubleSpinBox_min->setValue(0); + ui.doubleSpinBox_max->setValue(0); ui.checkBox->setChecked(false); QPixmap pix(MODEL_UI_ICON_NONE); ui.ModelMgr_modelpic_lable->setPixmap(pix.scaled(WS_PICSIZE, WS_PICSIZE)); diff --git a/tpvs17/tpMain/QModelMgrDlg.ui b/tpvs17/tpMain/QModelMgrDlg.ui index f37b235..1329f48 100644 --- a/tpvs17/tpMain/QModelMgrDlg.ui +++ b/tpvs17/tpMain/QModelMgrDlg.ui @@ -6,7 +6,7 @@ 0 0 - 1031 + 993 657 @@ -14,13 +14,6 @@ QModelMgrDlg - - - - - - - @@ -328,48 +321,49 @@ - 最小系数 + 最小偏距 - - - - 0 - 0 - + + + QAbstractSpinBox::NoButtons - - - 100 - 16777215 - + + 9999.989999999999782 - 最大系数 + 最大偏距 - - - - 0 - 0 - + + + QAbstractSpinBox::NoButtons - + + 9999.989999999999782 + + + + + + + Qt::Horizontal + + - 100 - 16777215 + 40 + 20 - + diff --git a/tpvs17/tpMain/QSystemSettingDlg.cpp b/tpvs17/tpMain/QSystemSettingDlg.cpp index cbe29bd..960486d 100644 --- a/tpvs17/tpMain/QSystemSettingDlg.cpp +++ b/tpvs17/tpMain/QSystemSettingDlg.cpp @@ -64,7 +64,7 @@ QSystemSettingDlg::QSystemSettingDlg(QWidget *parent) } connect(ui.listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(onSetCurrentIndex(int))); } - + ui.label->setVisible(false); } QSystemSettingDlg::~QSystemSettingDlg() @@ -237,6 +237,10 @@ void QSystemSettingDlg::addPicRoot(QTreeWidget *pTreewidget, QString strName) picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("原图")))); picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("原图")))); picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("背景图")))); +// picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("阈值参数")))); + picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("图像增强")))); + picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("过滤半径")))); + picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("偏距系数")))); picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("检测结果")))); picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("图像保存路径")))); picitems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("设置保存路径")))); @@ -268,11 +272,36 @@ void QSystemSettingDlg::addPicRoot(QTreeWidget *pTreewidget, QString strName) m_saveImgSrc_bad->setChecked(DetectState::instance()->saveBad == (int)true); QCheckBox *m_useBackground = new QCheckBox; - m_useBackground->setText(tr("使用背景图")); + m_useBackground->setText(tr("使用背景图抠图")); m_useBackground->setObjectName("m_useBackground"); connect(m_useBackground, SIGNAL(stateChanged(int)), this, SLOT(onCheckstateChanged(int))); m_useBackground->setChecked(DetectState::instance()->m_UseBackground == (int)true); - +//算法参数 +// m_Algthreshold = new QSpinBox(); +// m_Algthreshold->setMinimum(0); +// m_Algthreshold->setMaximum(255); +// m_Algthreshold->setToolTip(tr("背景图抠图算法阈值参数")); +// m_Algthreshold->setValue(DetectState::instance()->m_AlgThres); + + QCheckBox *m_bEqual = new QCheckBox; + m_bEqual->setText(tr("使用图像增强")); + m_bEqual->setObjectName("m_bEqual"); + connect(m_bEqual, SIGNAL(stateChanged(int)), this, SLOT(onCheckstateChanged(int))); + m_bEqual->setChecked(DetectState::instance()->m_bUseEqual); + + m_AlgFilterSize = new QSpinBox(); + m_AlgFilterSize->setMinimum(1); + m_AlgFilterSize->setMaximum(9999); + m_AlgFilterSize->setToolTip(tr("过滤圆半径Size")); + m_AlgFilterSize->setValue(DetectState::instance()->m_filterSize); + + QCheckBox *m_useRatio = new QCheckBox; + m_useRatio->setText(tr("使用偏距系数过滤模板")); + m_useRatio->setObjectName("m_useRatio"); + connect(m_useRatio, SIGNAL(stateChanged(int)), this, SLOT(onCheckstateChanged(int))); + m_useRatio->setChecked(DetectState::instance()->m_RatioDetectType == 0 ? false : true); + +// QCheckBox *m_ResAll2A = new QCheckBox; m_ResAll2A->setText(tr("轮毂全去A通道")); m_ResAll2A->setObjectName("m_ResAll2A"); @@ -303,17 +332,27 @@ void QSystemSettingDlg::addPicRoot(QTreeWidget *pTreewidget, QString strName) pTreewidget->setItemWidget(picitems.at(3), 1, m_saveImgSrc_good); pTreewidget->setItemWidget(picitems.at(4), 1, m_saveImgSrc_bad); pTreewidget->setItemWidget(picitems.at(5), 1, m_useBackground); - pTreewidget->setItemWidget(picitems.at(6), 1, m_ResAll2A); - pTreewidget->setItemWidget(picitems.at(7), 1, m_pLbShowPath); - pTreewidget->setItemWidget(picitems.at(8), 1, pbSetSavePath); - pTreewidget->setItemWidget(picitems.at(9), 1, pbOpenImgPath); - pTreewidget->setItemWidget(picitems.at(10), 1, pSavePara); +// pTreewidget->setItemWidget(picitems.at(6), 1, m_Algthreshold); + pTreewidget->setItemWidget(picitems.at(6), 1, m_bEqual); + pTreewidget->setItemWidget(picitems.at(7), 1, m_AlgFilterSize); + pTreewidget->setItemWidget(picitems.at(8), 1, m_useRatio); + + pTreewidget->setItemWidget(picitems.at(9), 1, m_ResAll2A); + pTreewidget->setItemWidget(picitems.at(10), 1, m_pLbShowPath); + pTreewidget->setItemWidget(picitems.at(11), 1, pbSetSavePath); + pTreewidget->setItemWidget(picitems.at(12), 1, pbOpenImgPath); + pTreewidget->setItemWidget(picitems.at(13), 1, pSavePara); m_listObj.append(pChangeBGbp); m_listObj.append(m_saveImgRes_bad); m_listObj.append(m_saveImgRes_good); m_listObj.append(m_saveImgSrc_bad); m_listObj.append(m_useBackground); +// m_listObj.append(m_Algthreshold); + m_listObj.append(m_bEqual); + m_listObj.append(m_AlgFilterSize); + m_listObj.append(m_useRatio); + m_listObj.append(m_saveImgSrc_good); m_listObj.append(m_ResAll2A); m_listObj.append(m_pLbShowPath); @@ -332,6 +371,10 @@ void QSystemSettingDlg::addPicRoot(QTreeWidget *pTreewidget, QString strName) picitems.at(8)->setSizeHint(1, QSize(100, 40)); picitems.at(9)->setSizeHint(1, QSize(100, 40)); picitems.at(10)->setSizeHint(1, QSize(100, 40)); + picitems.at(11)->setSizeHint(1, QSize(100, 40)); + picitems.at(12)->setSizeHint(1, QSize(100, 40)); + picitems.at(13)->setSizeHint(1, QSize(100, 40)); +// picitems.at(14)->setSizeHint(1, QSize(100, 40)); } void QSystemSettingDlg::addPLCRoot(QTreeWidget *pTreewidget, QString strName) @@ -722,6 +765,12 @@ Q_SLOT void QSystemSettingDlg::onCheckstateChanged(int state) else if (strObj == "m_useBackground") { DetectState::instance()->m_UseBackground = int(state == 2); } + else if (strObj == "m_bEqual") { + DetectState::instance()->m_bUseEqual = int(state == 2); + } + else if (strObj == "m_useRatio") { + DetectState::instance()->m_RatioDetectType = int(state == 2); + } else if (strObj == "m_ResAll2A") { DetectState::instance()->m_bObjAll2A = (state == 2 ? true : false); } @@ -822,6 +871,19 @@ Q_SLOT void QSystemSettingDlg::onSavePLCPara() // emit sgShowMsg(tr("数据已发送并保存")); emit sgChangePLCParam(); } + showTipInfo(); +} + +void QSystemSettingDlg::showTipInfo() +{ + if (m_timerID != 0) + { + killTimer(m_timerID); + m_timerID = 0; + } + m_timerID = startTimer(1000); + ui.label->setVisible(true); + emit sgParamChange(); } void QSystemSettingDlg::readSettingFile() @@ -886,6 +948,16 @@ void QSystemSettingDlg::showEvent(QShowEvent *event) } +void QSystemSettingDlg::timerEvent(QTimerEvent *event) +{ + if (event->timerId() == m_timerID) + { + killTimer(m_timerID); + m_timerID = 0; + ui.label->setVisible(false); + } +} + Q_SLOT void QSystemSettingDlg::onTreeWidgetButton() { QString strObj = sender()->objectName(); @@ -946,8 +1018,16 @@ Q_SLOT void QSystemSettingDlg::onTreeWidgetButton() else DetectState::instance()->m_CameraTrigeType = 0; } + if (m_AlgFilterSize) + { + DetectState::instance()->m_filterSize = m_AlgFilterSize->value(); + } +// if (m_Algthreshold) +// { +// DetectState::instance()->m_AlgThres = m_Algthreshold->value(); +// } DetectState::instance()->saveDeteImage(); - //emit sgShowMsg(tr("保存完成")); + showTipInfo(); } } diff --git a/tpvs17/tpMain/QSystemSettingDlg.h b/tpvs17/tpMain/QSystemSettingDlg.h index d5f3d87..cb3c2de 100644 --- a/tpvs17/tpMain/QSystemSettingDlg.h +++ b/tpvs17/tpMain/QSystemSettingDlg.h @@ -20,6 +20,7 @@ public: signals: void sgChangeLanguage(QString strLanguage); void sgChangePLCParam(); + void sgParamChange(); private: bool InitTreeWidget(QTreeWidget* pTreewidget); void addComRoot(class QTreeWidget *pTreewidget, QString strName /*= QString()*/); @@ -44,9 +45,11 @@ private: Q_SLOT void onCheckstateChanged(int state); Q_SLOT void onSetCurrentIndex(int nIndex); Q_SLOT void onSavePLCPara(); + + void showTipInfo(); protected: virtual void showEvent(QShowEvent *event); - + virtual void timerEvent(QTimerEvent *event); private: Ui::QSystemSettingUI ui; QList m_listObj; @@ -74,6 +77,9 @@ private: class QComboBox *m_PLCTrigerType{ nullptr }; class QSpinBox *m_PLC_RestartSeverCount{ nullptr }; +// class QSpinBox *m_Algthreshold{ nullptr }; + class QSpinBox *m_AlgFilterSize{ nullptr }; + QStringList m_listwidgetItemStr; QDiskCleanThread *pDiskCleanThread{ nullptr }; QSettings *m_setting{ nullptr }; @@ -81,6 +87,9 @@ private: bool nCheckThreadEable{ false }; class QLabel* m_pLbShowPath{ nullptr }; + + + int m_timerID{ 0 }; }; #endif diff --git a/tpvs17/tpMain/QSystemSettingUI.ui b/tpvs17/tpMain/QSystemSettingUI.ui index b155624..a1a4b81 100644 --- a/tpvs17/tpMain/QSystemSettingUI.ui +++ b/tpvs17/tpMain/QSystemSettingUI.ui @@ -14,11 +14,11 @@ 系统设置 - - + + - 2 + 6 0 @@ -27,13 +27,18 @@ 12 + + + 1 + + - - + + - 6 + 2 0 @@ -42,11 +47,13 @@ 12 - - - 1 - - + + + + + + 参数设置已生效!!! + diff --git a/tpvs17/tpMain/lpMainWin.cpp b/tpvs17/tpMain/lpMainWin.cpp index c402095..8976a4d 100644 --- a/tpvs17/tpMain/lpMainWin.cpp +++ b/tpvs17/tpMain/lpMainWin.cpp @@ -22,9 +22,9 @@ #include "QZkJsonParser.h" #include -#define VERSION_HUB "3.0.0.3" -#define VERSION_ALG "3.0.0.3" -#define UPDATE_TIME "2021-09-07" +#define VERSION_HUB "3.0.1.0" +#define VERSION_ALG "3.0.1.0" +#define UPDATE_TIME "2021-09-16" #pragma execution_character_set("utf-8") lpMainWin::lpMainWin(QWidget *parent) @@ -153,7 +153,7 @@ lpMainWin::lpMainWin(QWidget *parent) m_CamSettingDlg->setCoreCtrlPtr(m_pCoreCtrl); connect(m_pSystemSettingDlg, SIGNAL(sgChangeLanguage(QString)), this, SLOT(onLanguageChange(QString))); connect(m_pSystemSettingDlg, SIGNAL(sgChangePLCParam()), this, SLOT(onChangePLCParam())); - + connect(m_pSystemSettingDlg, SIGNAL(sgParamChange()), this, SLOT(onUpdateUI())); m_pixMapList = new QPixmapListBar(ui.tp_main_tabWidget); ui.tp_main_tabWidget->insertTab(0, m_pixMapList, tr("历史")); ui.tp_main_tabWidget->setCurrentIndex(0); @@ -188,7 +188,7 @@ lpMainWin::lpMainWin(QWidget *parent) connect(m_pNet, SIGNAL(sgRecvTrigPara()), this, SLOT(onRecvTrigPara())); connect(m_pNet, SIGNAL(sgReadDetectState(int, QString)), this, SLOT(onReadDetectState(int, QString))); connect(m_pNet, SIGNAL(sgReadDetectStateASK()), this, SLOT(onReadDetectStateASK())); - connect(m_pNet, SIGNAL(sgCameraTrig(int)), this, SLOT(onTrigRecv(int))); + connect(m_pNet, SIGNAL(sgCameraTrig(int,double)), this, SLOT(onTrigRecv(int,double))); connect(m_pNet, SIGNAL(sgServerState(QString, int, bool)), this, SLOT(onServerState(QString, int, bool))); connect(m_pNet, SIGNAL(sgShutDownComputer()), this, SLOT(onShutDownComputer())); connect(m_pNet, SIGNAL(sgLibRev(bool)), SendModelLibTask, SLOT(WaitSingleIn(bool)));//xy lib @@ -259,8 +259,11 @@ lpMainWin::lpMainWin(QWidget *parent) //m_PulseTimer.start(1000); connect(this, SIGNAL(sgAutoExposure()), this, SLOT(onAutoExposure())); + connect(this, SIGNAL(sgShowRatioVal(double)), this, SLOT(onShowRatioVal(double))); QString strPath = QApplication::applicationDirPath(); readExposureTimeConfig(strPath); + + onUpdateUI(); } lpMainWin::~lpMainWin() @@ -536,13 +539,15 @@ void lpMainWin::INewCameraImage(const QString& camKey, QImage img) /*多线程发送算法结果*/ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap) { + m_glbalRatio = 0; emit(sgShowImgState(tr("显示识别结果"))); Result2Ui *pResult = (Result2Ui*)vMap.value("result").toLongLong(); + double vRatioVal = vMap.value("ratioVal").toDouble(); if (pResult == nullptr) { pResult = new Result2Ui(); } - + emit sgShowRatioVal(vRatioVal); // 当没抠出轮毂和NG时自动调整曝光时间重新拍照,最多调整的次数为5次 if (m_autoExposureSwitch) { @@ -563,7 +568,6 @@ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap) m_exposureTimeCount++; if (m_exposureTimeCount >= m_exposureTimeArray.size()) { - // m_exposureTimeCount = 0; emit(sgShowMsgdlg(tr("调整5次曝光时间后依然未能识别到轮毂!"))); } else @@ -594,7 +598,6 @@ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap) m_exposureTimeCount++; if (m_exposureTimeCount >= m_exposureTimeArray.size()) { - // m_exposureTimeCount = 0; emit(sgShowMsgdlg(tr("调整5次曝光时间后依然未能识别到轮毂!"))); } else @@ -626,18 +629,14 @@ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap) m_pCoreCtrl->ISetExposureTime(m_camKey, exp); } -// m_pUi->processResult(pResult); static int ErrorNum = 0; if (m_pNet) { if (pResult->m_strModel == "NG") { - //m_pNet->sendLight(0, 1, 1000, 10);//红灯 - SendResultBee(LIGHT_REDBEE, 1); SendResultBee(LIGHT_BEE, 1); ErrorNum++; } else { - //m_pNet->sendLight(2, 1, 1000, 100); SendResultBee(LIGHT_GREENBEE, 1); ErrorNum = 0; } @@ -646,8 +645,6 @@ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap) if (DetectState::instance()->IsDetect == false) str += tr(",未开启检测功能造成的"); m_pCtrl->addLog(str, emTypeWaring); - //m_pNet->sendLight(0, 1, 2000, 100); - //m_pNet->sendLight(3, 1, 3000, 100); SendResultBee(LIGHT_REDBEE, 3); SendResultBee(LIGHT_BEE, 3); } @@ -657,7 +654,7 @@ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap) SendResultStr2PLC(pResult);//发送检测结果字符到PLC if (DetectState::instance()->m_SendChannelRes2COM) SendResultChannelCOM(pResult);//发送检测结果通道到串口 - if (DetectState::instance()->m_SendChannelRes2Net) + if (DetectState::instance()->m_SendChannelRes2Net>0 && DetectState::instance()->m_IsUseChannel>0) SendResultChannel2PLC(pResult);//发送检测结果通道到PLC m_pCtrl->saveResult(pResult); @@ -683,17 +680,21 @@ QVariant lpMainWin::IGetVariantById(int id) if (DetectState::instance()->m_IsUseRaster == 0) nThickness = m_nWfThress; else - nThickness = m_pCtrl->getThickness();// m_houduVec.first(); - //nThickness = 209; + nThickness = m_pCtrl->getThickness(); + vMap.insert("thickness", QVariant(nThickness)); double dDiameter;// = (-794.25 * nThickness / 1000000.0 + 0.775960); dDiameter = (DetectState::instance()->m_k * nThickness + DetectState::instance()->m_b); vMap.insert("d2h", dDiameter); vMap.insert("useThickness", DetectState::instance()->bUseThickness); vMap.insert("useDiameter", DetectState::instance()->bUseDiameter); - vMap.insert("Threshold", DetectState::instance()->m_AlgThres); + vMap.insert("Threshold", DetectState::instance()->m_AlgThres);//算法图像阈值 vMap.insert("IsCutImg", DetectState::instance()->m_UseCutImg); vMap.insert("useBackground", DetectState::instance()->m_UseBackground>0?true:false);//使用背景图 + vMap.insert("Ratio", m_glbalRatio);//偏距系数 + vMap.insert("RatioType", DetectState::instance()->m_RatioDetectType);//偏距检测模式 启用方式 + vMap.insert("bEqual", DetectState::instance()->m_bUseEqual);//使用使用图像增强 + vMap.insert("filterSize", DetectState::instance()->m_filterSize);//过滤圆大小 void* address = (void*)m_pCtrl->getAllModelMapPtr(); long long varadr = (long long)address; @@ -711,7 +712,6 @@ QVariant lpMainWin::IGetVariantById(int id) return vMap; } - Q_SLOT void lpMainWin::onLogInOut(QString strName, int level, int state) { lpGlobalData::instance()->m_curUser = strName; @@ -1226,8 +1226,9 @@ Q_SLOT void lpMainWin::onReadDetectStateASK() } } -Q_SLOT void lpMainWin::onTrigRecv(int m_value) +Q_SLOT void lpMainWin::onTrigRecv(int m_value,double dRatio) { + m_glbalRatio = dRatio; /*用于接收PLC触发相机的信号 自检是否收到图像 */ qDebug() << "recv a camera trig :" << QString::number(m_value); qWarning() << "recv a Triger signal from PLC:" << "(" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss zzz") << ")"; @@ -1730,4 +1731,32 @@ Q_SLOT void lpMainWin::onAutoExposure() } onTriggerCam(); +} + +Q_SLOT void lpMainWin::onUpdateUI() +{ + if (DetectState::instance()->m_IsUseChannel > 0) + { + ui.main_lb_res_Channle->setVisible(true); + ui.main_lb_res_Channle_Show->setVisible(true); + } + else { + ui.main_lb_res_Channle->setVisible(false); + ui.main_lb_res_Channle_Show->setVisible(false); + } + + if (DetectState::instance()->m_RatioDetectType > 0) + { + ui.label_ratioTitle->setVisible(true); + ui.label_ratioValue->setVisible(true); + } + else { + ui.label_ratioTitle->setVisible(false); + ui.label_ratioValue->setVisible(false); + } +} + +Q_SLOT void lpMainWin::onShowRatioVal(double val) +{ + ui.label_ratioValue->setText(QString("%1").arg(val)); } \ No newline at end of file diff --git a/tpvs17/tpMain/lpMainWin.h b/tpvs17/tpMain/lpMainWin.h index 5301a7e..587855f 100644 --- a/tpvs17/tpMain/lpMainWin.h +++ b/tpvs17/tpMain/lpMainWin.h @@ -62,11 +62,14 @@ signals: void operate(); void sgNetData(int, QVariantMap); void sgAutoExposure(); + void sgShowRatioVal(double val); private: Q_SLOT void onLogInOut(QString strName, int level, int state); Q_SLOT void onActionClicked(); Q_SLOT void onButtonClicked(); Q_SLOT void onAutoExposure(); + Q_SLOT void onUpdateUI();//修改参数应用时,刷新UI显示内容 + Q_SLOT void onShowRatioVal(double val); protected: bool onInitCoreCtrl(); @@ -93,7 +96,7 @@ protected: Q_SLOT void onRecvTrigPara(); Q_SLOT void onReadDetectState(int nIndex, QString strModel); Q_SLOT void onReadDetectStateASK(); - Q_SLOT void onTrigRecv(int m_value); + Q_SLOT void onTrigRecv(int m_value, double dRatio); Q_SLOT void onServerState(QString Addr, int port, bool m_state); Q_SLOT void onShutDownComputer(); //timer slot @@ -199,7 +202,7 @@ private: bool readExposureTimeConfig(const QString& strPath); int getCurExposureTime(); - + double m_glbalRatio{ 0.0 };//偏距系数 }; #endif diff --git a/tpvs17/tpMain/lpMainWin.ui b/tpvs17/tpMain/lpMainWin.ui index d854b41..d4d2a75 100644 --- a/tpvs17/tpMain/lpMainWin.ui +++ b/tpvs17/tpMain/lpMainWin.ui @@ -229,7 +229,7 @@ 6 - + @@ -288,152 +288,149 @@ 0 - - - - - 0 - 0 - + + + + + 0 + 0 + - - true + + + 12 + 75 + true + - - true + + background-color: rgb(170, 170, 127); + + + 0 + + + Qt::AlignCenter + + + + + + + + 12 + - font: 75 12pt "Consolas"; + QFrame::Sunken - 无匹配(个) + 通道 true - - + + - 0 - 0 + 120 + 120 - - true - - - false - - font: 75 12pt "Consolas"; + background-color: rgb(200, 200, 200); - QFrame::NoFrame + QFrame::Box - 已检测(个) - - - Qt::AutoText + - true - - - - - - - - 82 - 16777215 - + false - - font: 75 12pt "Consolas"; + + Qt::AlignCenter - - 匹配值 + + false - - - - - 70 - 19 - + + + + + 0 + 0 + - - - 82 - 16777215 - + + + 12 + 75 + true + - font: 75 12pt "Consolas"; + background-color: rgb(170, 170, 127); - 直径(mm) + 0 + + + Qt::AlignCenter - - - - - 82 - 0 - - - - - 82 - 16777215 - - - - font: 75 12pt "Consolas"; + + + + + 0 + 0 + - - 时间(s) + + + 12 + 75 + true + - - - - - font: 75 12pt "Consolas"; - - - QFrame::Sunken + background-color: rgb(170, 170, 127); - 通道 + 0 - - true + + Qt::AlignCenter - - + + - + 0 0 + + + 132 + 0 + + - font: 75 12pt "Consolas"; -background-color: rgb(170, 170, 127); + font: 24pt "Consolas"; 0 @@ -443,17 +440,24 @@ background-color: rgb(170, 170, 127); - - + + - + 0 0 + + + 12 + 75 + true + + - font: 75 12pt "Consolas"; -background-color: rgb(170, 170, 127); + background-color: rgb(170, 170, 127); + 0 @@ -463,39 +467,63 @@ background-color: rgb(170, 170, 127); - - + + + + + 0 + 0 + + + + + 12 + + + + true + + + false + - font: 75 12pt "Consolas"; -background-color: rgb(170, 170, 127); + + + + QFrame::NoFrame - --------- + 已检测(个) - - Qt::AlignCenter + + Qt::AutoText + + + true - - - - - 0 - 0 - - + + - 132 - 0 + 0 + 5 - - font: 24pt "Consolas"; + + + 16777215 + 15 + + + + + 11 + - 0 + 检测状态 Qt::AlignCenter @@ -522,97 +550,118 @@ font: 75 24pt "Consolas"; - - - - - 0 - 0 - + + + + + 0 + 0 + + + + + 12 + + + + true + + + true - background-color: rgb(170, 170, 127); -font: 75 12pt "Consolas"; + + + + QFrame::Sunken - 0 + 无匹配(个) - - Qt::AlignCenter + + true - - - + + + - 120 - 120 + 82 + 16777215 - - background-color: rgb(200, 200, 200); + + + 12 + - - QFrame::Box + + - + 匹配值 - - false + + + + + + + 70 + 19 + - - Qt::AlignCenter + + + 82 + 16777215 + - - false + + + 12 + + + + + + + 直径(mm) - - + + - Consolas 12 - 9 - false - false + 75 + true - background-color: rgb(170, 170, 127); -font: 75 12pt "Consolas"; + background-color: rgb(170, 170, 127); - 0 + --------- Qt::AlignCenter - - - - - 0 - 0 - - + + - Consolas 12 - 9 - false - false + 75 + true - font: 75 12pt "Consolas"; -background-color: rgb(170, 170, 127); + background-color: rgb(170, 170, 127); 0 @@ -622,44 +671,50 @@ background-color: rgb(170, 170, 127); - - + + - 0 - 5 + 82 + 0 - 16777215 - 15 + 82 + 16777215 - 11 + 12 - - 检测状态 + + - - Qt::AlignCenter + + 时间(s) - - + + - + 0 0 + + + 12 + 75 + true + + - font: 75 12pt "Consolas"; -background-color: rgb(170, 170, 127); + background-color: rgb(170, 170, 127); 0 @@ -677,14 +732,51 @@ background-color: rgb(170, 170, 127); 16777215 + + + 12 + + - font: 75 12pt "Consolas"; + 厚度(mm) + + + + + 12 + + + + 偏距 + + + + + + + + 12 + 75 + true + + + + background-color: rgb(170, 170, 127); + + + 0 + + + Qt::AlignCenter + + + @@ -762,7 +854,7 @@ background-color: rgb(170, 170, 127); - 11 + 12 diff --git a/tpvs17/tpMain/tpMain.vcxproj b/tpvs17/tpMain/tpMain.vcxproj index 9449486..9a91310 100644 --- a/tpvs17/tpMain/tpMain.vcxproj +++ b/tpvs17/tpMain/tpMain.vcxproj @@ -33,7 +33,6 @@ - @@ -111,6 +110,9 @@ true + + true + true @@ -249,6 +251,9 @@ true + + true + true @@ -336,6 +341,7 @@ + @@ -345,6 +351,16 @@ + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_CORE_LIB -DTPMAIN_LIB -DTPMAIN_EXPORTS -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_PRINTSUPPORT_LIB -DQT_NETWORK_LIB -DQT_SERIALPORT_LIB -D_WINDOWS -D%(PreprocessorDefinitions) "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\ActiveQt" "-I$(QTDIR)\include\QtSerialPort" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSql" "-I$(QTDIR)\include\QtNetwork" "-I.\..\..\src\algorithm" "-I.\..\..\src\tpMain" "-I.\..\..\src\tpMain\thread" "-I.\..\..\src\tpMain\splashScreen" "-I.\..\..\src\tpMain\LightBoxwidget" "-I.\..\..\src\tpMain\QDiskCleanThread" "-I.\..\..\src\tpMain\QPixmapListBar" "-I.\..\..\src\userCtrl" "-I.\..\..\src\NetWheel" "-I.\..\..\src\RasterSDG20" "-I.\..\..\src\ReportModel" "-I.\..\..\3part\libzkq\include" "-I.\..\..\3part\tadpole\include\tpBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\3part\edcircle\include" "-I.\..\..\3part\lpCoreCtrl\include" "-I.\..\..\src\tpMain\algela" "-I.\..\..\src\ImageCompare" "-I.\..\..\src\interface" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DTPMAIN_LIB -DTPMAIN_EXPORTS -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_PRINTSUPPORT_LIB -DQT_NETWORK_LIB -DQT_SERIALPORT_LIB -D%(PreprocessorDefinitions) "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\ActiveQt" "-I$(QTDIR)\include\QtSerialPort" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSql" "-I$(QTDIR)\include\QtNetwork" "-I.\..\..\src\algorithm" "-I.\..\..\src\tpMain" "-I.\..\..\src\tpMain\thread" "-I.\..\..\src\tpMain\splashScreen" "-I.\..\..\src\tpMain\LightBoxwidget" "-I.\..\..\src\tpMain\QDiskCleanThread" "-I.\..\..\src\tpMain\QPixmapListBar" "-I.\..\..\src\userCtrl" "-I.\..\..\src\NetWheel" "-I.\..\..\src\RasterSDG20" "-I.\..\..\src\ReportModel" "-I.\..\..\3part\libzkq\include" "-I.\..\..\3part\tadpole\include\tpBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\3part\lpCoreCtrl\include" "-I.\..\..\src\tpMain\algela" "-I.\..\..\src\ImageCompare" "-I.\..\..\src\interface" "-I.\..\..\3part\edcircle\include" + $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing %(Identity)... @@ -419,6 +435,7 @@ + @@ -779,7 +796,6 @@ .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DTPMAIN_LIB -DTPMAIN_EXPORTS -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_PRINTSUPPORT_LIB -DQT_NETWORK_LIB -DQT_SERIALPORT_LIB -D%(PreprocessorDefinitions) "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\ActiveQt" "-I$(QTDIR)\include\QtSerialPort" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSql" "-I$(QTDIR)\include\QtNetwork" "-I.\..\..\src\algorithm" "-I.\..\..\src\tpMain" "-I.\..\..\src\tpMain\thread" "-I.\..\..\src\tpMain\splashScreen" "-I.\..\..\src\tpMain\LightBoxwidget" "-I.\..\..\src\tpMain\QDiskCleanThread" "-I.\..\..\src\tpMain\QPixmapListBar" "-I.\..\..\src\userCtrl" "-I.\..\..\src\NetWheel" "-I.\..\..\src\RasterSDG20" "-I.\..\..\src\ReportModel" "-I.\..\..\3part\libzkq\include" "-I.\..\..\3part\tadpole\include\tpBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\3part\lpCoreCtrl\include" "-I.\..\..\src\tpMain\algela" "-I.\..\..\src\ImageCompare" "-I.\..\..\src\interface" "-I.\..\..\3part\edcircle\include" - $(QTDIR)\bin\moc.exe;%(FullPath) @@ -1291,6 +1307,16 @@ + + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + {A229CF5C-81EF-4909-AB6E-49C746F1ED4C} diff --git a/tpvs17/tpMain/tpMain.vcxproj.filters b/tpvs17/tpMain/tpMain.vcxproj.filters index e0f23e5..a83f12c 100644 --- a/tpvs17/tpMain/tpMain.vcxproj.filters +++ b/tpvs17/tpMain/tpMain.vcxproj.filters @@ -190,9 +190,6 @@ Generated Files\Release - - Source Files - Generated Files\Debug @@ -547,6 +544,15 @@ Source Files + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + @@ -576,9 +582,6 @@ Header Files - - Header Files - Header Files @@ -696,6 +699,9 @@ Header Files + + Generated Files + @@ -887,6 +893,12 @@ Form Files + + Header Files + + + Form Files + diff --git a/tpvs17/wheel.sln b/tpvs17/wheel.sln index b08db5c..d3f3f0d 100644 --- a/tpvs17/wheel.sln +++ b/tpvs17/wheel.sln @@ -19,6 +19,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tpCamBaumer", "..\..\Valve\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lpReport", "lpReport\lpReport.vcxproj", "{0E042214-1B06-40D6-9D20-C6D5FA3D7A51}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Net4Wheel", "Net4Wheel\Net4Wheel.vcxproj", "{9B718379-3719-4D4E-A903-EDE7EFB4DC65}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -77,6 +79,12 @@ Global {0E042214-1B06-40D6-9D20-C6D5FA3D7A51}.Release|x64.ActiveCfg = Release|x64 {0E042214-1B06-40D6-9D20-C6D5FA3D7A51}.Release|x64.Build.0 = Release|x64 {0E042214-1B06-40D6-9D20-C6D5FA3D7A51}.Release|x86.ActiveCfg = Release|x64 + {9B718379-3719-4D4E-A903-EDE7EFB4DC65}.Debug|x64.ActiveCfg = Debug|x64 + {9B718379-3719-4D4E-A903-EDE7EFB4DC65}.Debug|x64.Build.0 = Debug|x64 + {9B718379-3719-4D4E-A903-EDE7EFB4DC65}.Debug|x86.ActiveCfg = Debug|x64 + {9B718379-3719-4D4E-A903-EDE7EFB4DC65}.Release|x64.ActiveCfg = Release|x64 + {9B718379-3719-4D4E-A903-EDE7EFB4DC65}.Release|x64.Build.0 = Release|x64 + {9B718379-3719-4D4E-A903-EDE7EFB4DC65}.Release|x86.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE