From 737d741406b5e0c33444164a377895605d50e456 Mon Sep 17 00:00:00 2001 From: jerryzeng Date: Mon, 24 Aug 2026 15:50:13 +0800 Subject: [PATCH] =?UTF-8?q?SX=5FlapWeldDetection=20version=201.2.0=20:?= =?UTF-8?q?=E7=84=8A=E7=BC=9D=EF=BC=88=E5=B9=B3=E7=BC=9D=EF=BC=89=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E6=B7=BB=E5=8A=A0=E5=8D=9A=E6=B8=85=E6=A8=A1=E6=8B=9F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=AD=E7=9A=84=E5=87=B8=E8=B5=B7=E7=84=8A?= =?UTF-8?q?=E7=BC=9D=EF=BC=8C=E9=80=9A=E8=BF=87=E5=8F=82=E6=95=B0=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E8=AF=86=E5=88=AB=E7=B1=BB=E5=9E=8B=EF=BC=88=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=8A=A8=E8=AF=86=E5=88=AB=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lapWeldDetection_test.cpp | 54 ++- sourceCode/SG_baseAlgo_Export.h | 1 + sourceCode/SG_baseDataType.h | 14 + sourceCode/SG_lineFeature.cpp | 368 +++++++++++++----- sourceCode/SX_lapWeldDetection.cpp | 3 +- 5 files changed, 337 insertions(+), 103 deletions(-) diff --git a/lapWeldDetection_test/lapWeldDetection_test.cpp b/lapWeldDetection_test/lapWeldDetection_test.cpp index 8ee2e7e..7b23324 100644 --- a/lapWeldDetection_test/lapWeldDetection_test.cpp +++ b/lapWeldDetection_test/lapWeldDetection_test.cpp @@ -744,6 +744,19 @@ void _removeZeroLines_XYZ(std::vector>& scanData) return; } +void _outputWeldInfo(char* outFileName, std::vector& weldRawPoints) +{ + std::ofstream sw(outFileName); + char dataStr[250]; + + for (int i = 0; i < (int)weldRawPoints.size(); i++) + { + sprintf_s(dataStr, 250, "id_%d: (%g, %g, %g)", i+1, weldRawPoints[i].x, weldRawPoints[i].y, weldRawPoints[i].z); + sw << dataStr << std::endl; + } + sw.close(); +} + #define CONVERT_TO_GRID 0 #define TEST_COMPUTE_CALIB_PARA 0 #define TEST_COMPUTE_POSITION 1 @@ -916,15 +929,16 @@ void lapWeldTest() #define TEST_BQ_CALIB_PARA 0 #define TEST_BQ_WELD_SEAM 1 -#define BQ_TEST_GROUP 1 +#define BQ_TEST_GROUP 2 void BQ_thinWeldSeamTest() { const char* dataPath[BQ_TEST_GROUP] = { "F:/ShangGu/项目/冠钦_å�šæ¸…ç§‘æŠ€/焊ç¼�识别/æ•°æ�®/", //0 + "F:/ShangGu/项目/冠钦_å�šæ¸…ç§‘æŠ€/焊ç¼�识别/å�šæ¸…å®žéªŒå®¤æ¨¡æ‹Ÿæ•°æ�®/", //0 }; SVzNLRange fileIdx[BQ_TEST_GROUP] = { - {1,4}, + {1,4},{1,2} }; @@ -1003,7 +1017,7 @@ void BQ_thinWeldSeamTest() #if TEST_BQ_WELD_SEAM //for (int group = 0; group < TEST_GROUPS; group++) - for (int grp = 0; grp < BQ_TEST_GROUP; grp++) + for (int grp = 1; grp < BQ_TEST_GROUP; grp++) { SSG_planeCalibPara groundCalibPara; //åˆ�始化æˆ�å�•ä½�阵 @@ -1020,8 +1034,11 @@ void BQ_thinWeldSeamTest() for (int i = 0; i < 9; i++) groundCalibPara.invRMatrix[i] = groundCalibPara.planeCalib[i]; char calibFile[250]; - sprintf_s(calibFile, "%sground_calib_para.txt", dataPath[grp]); - groundCalibPara = _readCalibPara(calibFile); + if (0 == grp) + { + sprintf_s(calibFile, "%sground_calib_para.txt", dataPath[grp]); + groundCalibPara = _readCalibPara(calibFile); + } double para_chkWidth_wide = 2.5f; @@ -1029,22 +1046,32 @@ void BQ_thinWeldSeamTest() SVzNLRangeD gapParam; SWD_valleyParam valleyParam; - valleyParam.chkWin_width = 2.5; //mm, 检测2.5mm宽的Våž‹ + valleyParam.chkWin_width = 5.0; // 2.5; //mm, 检测2.5mm宽的Våž‹ valleyParam.maxWidth = 20.0; //最大宽度20mm,用于过滤虚å�‡ä¿¡å�· - valleyParam.minHeight = 1.0; + valleyParam.minHeight = 0.5; SSG_treeGrowParam growParam; growParam.maxLineSkipNum = 50; - growParam.yDeviation_max = 1.0; + growParam.yDeviation_max = 1.5; growParam.maxSkipDistance = 30.0; growParam.zDeviation_max = 5.0;// growParam.minLTypeTreeLen = 50; //mm, growParam.minVTypeTreeLen = 50; //mm + EWD_FlawType detectType; + if(0 == grp) + detectType = keWD_FlawType_Depression; + else + detectType = keWD_FlawType_Protrusion; + for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++) { + //fidx = 2; char _scan_file[256]; - sprintf_s(_scan_file, "%s%d_LaserData_Jl26C077.txt", dataPath[grp], fidx); + if(0 == grp) + sprintf_s(_scan_file, "%s%d_LaserData_Jl26C077.txt", dataPath[grp], fidx); + else + sprintf_s(_scan_file, "%s%d_LaserData_Jh26B083.txt", dataPath[grp], fidx); printf("process: %s......\n", _scan_file); std::vector> scanLines; @@ -1059,6 +1086,9 @@ void BQ_thinWeldSeamTest() std::vector trees; for (int i = 0; i < (int)scanLines.size(); i++) { + if (i == 117) + int kkk = 1; + std::vector& a_line = scanLines[i]; std::vector< SSG_basicFeatureGap> line_valleys; sx_lineDataR(scanLines[i], groundCalibPara.planeCalib, -1);//调平,去除地é�¢ @@ -1074,11 +1104,12 @@ void BQ_thinWeldSeamTest() a_line, i, valleyParam, + detectType, line_valleys); #endif bool isLastLine = i == ((int)scanLines.size() - 1) ? true : false; - sg_lineGapsGrowing( + sg_lineGapsGrowing_treeFirst( i, isLastLine, line_valleys, @@ -1127,6 +1158,9 @@ void BQ_thinWeldSeamTest() std::vector< std::vector> multiSeam; multiSeam.push_back(weldOps); _outputRGBDScanLapWeld_RGBD(outFileName, scanLines, multiSeam, true); + sprintf_s(outFileName, "%sresult\\LaserLine%d_weldInfo.txt", dataPath[grp], fidx); + _outputWeldInfo(outFileName, weldOps); + } } #endif diff --git a/sourceCode/SG_baseAlgo_Export.h b/sourceCode/SG_baseAlgo_Export.h index 4dfa46c..cfd82f6 100644 --- a/sourceCode/SG_baseAlgo_Export.h +++ b/sourceCode/SG_baseAlgo_Export.h @@ -1133,4 +1133,5 @@ SG_APISHARED_EXPORT void wd_getLineVFlaws( std::vector& a_line, const int lineIdx, const SWD_valleyParam valleyParam, + const EWD_FlawType detectFlawType, std::vector< SSG_basicFeatureGap>& valleys); diff --git a/sourceCode/SG_baseDataType.h b/sourceCode/SG_baseDataType.h index a2c6028..2e07ac1 100644 --- a/sourceCode/SG_baseDataType.h +++ b/sourceCode/SG_baseDataType.h @@ -6,6 +6,14 @@ #define PI 3.14159265358979323846 +typedef enum +{ + keWD_FlawType_Uknown = 0, + keWD_FlawType_Depression, //°¼ÏÝ + keWD_FlawType_Protrusion, //͹Æð + keSG_FlawType_Dep_Prot, //°¼ÏݺÍ͹Æð»ìºÏ +} EWD_FlawType; + // ¶¨ÒåÅ·À­½Ç½á¹¹Ì壨µ¥Î»£º¶È£© typedef struct{ double roll; // ÈÆXÖáÐýת£¨ºá¹ö£© @@ -90,6 +98,12 @@ typedef struct int end; }SWD_Interval; //Çø¼ä +typedef struct SWD_IndexedValue +{ + int idx; + double value; +}SWD_IndexedValue; + typedef struct { bool validFlag; //ָʾ½á¹ûÊÇ·ñÓÐЧ diff --git a/sourceCode/SG_lineFeature.cpp b/sourceCode/SG_lineFeature.cpp index 493b2f6..be110e3 100644 --- a/sourceCode/SG_lineFeature.cpp +++ b/sourceCode/SG_lineFeature.cpp @@ -9702,7 +9702,7 @@ if (i == 98) return; } -enum STATES { null = 0, UP, DOWN }; +enum STATES { null = 0, UP, DOWN, USED }; struct posAttri { int peakPos; @@ -9797,8 +9797,17 @@ float _computeHeight(SVzNL3DPoint& startPt, SVzNL3DPoint& endPt, SVzNL3DPoint& v float height = fabs(_a * valleyPt.y + _b * valleyPt.z + _c) / sqrt(pow(_a, 2) + pow(_b, 2)); return height; } + +bool _sortFormZMaxToMin(const SWD_IndexedValue& a, const SWD_IndexedValue& b) { + return a.value > b.value; +} +bool _sortFormZMinToMax(const SWD_IndexedValue& a, const SWD_IndexedValue& b) { + return a.value < b.value; +} + /* startId, endId: ÓÐЧµãµÄÆðֹλÖ᣶ÔÓÚÕ¤¸ñÊý¾Ý¸ñʽ£¬¿ªÊ¼µÄ¿ÕµãºÍ½áÊøµÄ¿Õµã¶¼²»ÊÇÓÐЧµã */ -void _valleyDetect( +//°¼Ïݼì²â£¨depression) +void _depressionDetect( std::vector& a_line, const int lineIdx, const int startId, const int endId, std::vector& deriv_1_peaks, @@ -9816,129 +9825,300 @@ void _valleyDetect( double y_start = a_line[startId].pt3D.y; double y_end = a_line[endId].pt3D.y; - //Öð¸öpeak¼ì²â£ºÕýpeak + //°´peak£¨DOWN£©Öµ½øÐÐÅÅÐò + std::vector indexedPeaks; for (int i = 0; i < deriv_2_peaks.size(); i++) { - if (i == 153) - int kkk = 1; posAttri a_pos = deriv_2_peaks[i]; if ((a_pos.peakState == DOWN) && (deriv_2[a_pos.peakPos] < 0)) { - //¼ì²éÁ½²à - int preEdge = -1; - for (int j = a_pos.peakPos - 1; j > 0; j--) + SWD_IndexedValue a_indexdPeak; + a_indexdPeak.idx = i; + a_indexdPeak.value = a_line[a_pos.peakPos].pt3D.z; + indexedPeaks.push_back(a_indexdPeak); + } + } + std::sort(indexedPeaks.begin(), indexedPeaks.end(), _sortFormZMaxToMin); + //Öð¸öpeak¼ì²â£ºÕýpeak + for (int i = 0; i < (int)indexedPeaks.size(); i++) + { + int idx = indexedPeaks[i].idx; + if (idx == 153) + int kkk = 1; + posAttri a_pos = deriv_2_peaks[idx]; + //¼ì²éÁ½²à + int preEdge = -1; + for (int j = a_pos.peakPos - 1; j > 0; j--) + { + if ( (buff[j].peakState == DOWN)|| (buff[j].peakState == USED)) + break; + else if (buff[j].peakState == UP) { - if (buff[j].peakState == DOWN) - break; - else if (buff[j].peakState == UP) - { - if (deriv_1[j] > 0) - preEdge = j; - break; - } + if (deriv_1[j] > 0) + preEdge = j; + break; } - int postEdge = -1; - for (int j = a_pos.peakPos + 1; j < (int)a_line.size(); j++) + } + int postEdge = -1; + for (int j = a_pos.peakPos + 1; j < (int)a_line.size(); j++) + { + if ((buff[j].peakState == UP)|| (buff[j].peakState == USED)) + break; + else if (buff[j].peakState == DOWN) { - if (buff[j].peakState == UP) - break; - else if (buff[j].peakState == DOWN) - { - if (deriv_1[j] < 0) - postEdge = j; - break; - } + if (deriv_1[j] < 0) + postEdge = j; + break; } - // - if ((preEdge >= 0) && (postEdge >= 0)) //³õ²½·ûºÏ°¼ÏÝÌØµã + } + // + if ((preEdge >= 0) && (postEdge >= 0)) //³õ²½·ûºÏ°¼ÏÝÌØµã + { + float edge_value_pre = deriv_1[preEdge]; + float edge_value_post = deriv_1[postEdge]; + //¼ì²â¶Ô³ÆÐÔ + float min_value, max_value; + if (edge_value_pre < (-edge_value_post)) { - float edge_value_pre = deriv_1[preEdge]; - float edge_value_post = deriv_1[postEdge]; - //¼ì²â¶Ô³ÆÐÔ - float min_value, max_value; - if (edge_value_pre < (-edge_value_post)) + min_value = edge_value_pre; + max_value = -edge_value_post; + } + else + { + max_value = edge_value_pre; + min_value = -edge_value_post; + } + if (min_value > max_value / 10) //2023.05.02: ·Å¿í¡£µ±°¼ÏÝÔÚÐ±ÃæÉÏʱ£¬²»ÔÙÊÇmaxValue/2µÄÀíÏëÇé¿ö + { + //¼ì²é°¼ÏÝ¿í¶ÈÉî¶È£¬Â˳ýÔëÉù + float th_pre = edge_value_pre * 0.5; + int edge_pos_pre = -1; + for (int j = preEdge; j >= 0; j--) { - min_value = edge_value_pre; - max_value = -edge_value_post; - } - else - { - max_value = edge_value_pre; - min_value = -edge_value_post; - } - if (min_value > max_value / 10) //2023.05.02: ·Å¿í¡£µ±°¼ÏÝÔÚÐ±ÃæÉÏʱ£¬²»ÔÙÊÇmaxValue/2µÄÀíÏëÇé¿ö - { - //¼ì²é°¼ÏÝ¿í¶ÈÉî¶È£¬Â˳ýÔëÉù - float th_pre = edge_value_pre * 0.5; - int edge_pos_pre = -1; - for (int j = preEdge; j >= 0; j--) + if ( (deriv_1[j] <= th_pre) && (a_line[j].nPointIdx >= 0)) //·ÇÌî³äµã { - if ( (deriv_1[j] <= th_pre) && (a_line[j].nPointIdx >= 0)) //·ÇÌî³äµã - { - edge_pos_pre = j; - break; - } + edge_pos_pre = j; + break; } + } - float th_post = edge_value_post * 0.5; - int edge_pos_post = -1; - for (int j = postEdge; j < (int)a_line.size(); j++) + float th_post = edge_value_post * 0.5; + int edge_pos_post = -1; + for (int j = postEdge; j < (int)a_line.size(); j++) + { + if ((deriv_1[j] >= th_post) && (a_line[j].nPointIdx >= 0)) //·ÇÌî³äµã { - if ((deriv_1[j] >= th_post) && (a_line[j].nPointIdx >= 0)) //·ÇÌî³äµã - { - edge_pos_post = j; - break; - } + edge_pos_post = j; + break; } + } - //¼ì²â¿í¶È - if ((edge_pos_pre >= 0) && (edge_pos_post >= 0)) + //¼ì²â¿í¶È + if ((edge_pos_pre >= 0) && (edge_pos_post >= 0)) + { + //float width = a_line->m_p3DPositiont[edge_pos_post].pt3D.y - a_line->m_p3DPositiont[edge_pos_pre].pt3D.y; + float width = a_line[postEdge].pt3D.y - a_line[preEdge].pt3D.y; + if (width < valleyParam.maxWidth) { - //float width = a_line->m_p3DPositiont[edge_pos_post].pt3D.y - a_line->m_p3DPositiont[edge_pos_pre].pt3D.y; - float width = a_line[postEdge].pt3D.y - a_line[preEdge].pt3D.y; - if (width < valleyParam.maxWidth) + float height = _computeHeight(a_line[edge_pos_pre].pt3D, + a_line[edge_pos_post].pt3D, + a_line[a_pos.peakPos].pt3D); + if (height > valleyParam.minHeight) { - float height = _computeHeight(a_line[edge_pos_pre].pt3D, - a_line[edge_pos_post].pt3D, - a_line[a_pos.peakPos].pt3D); - if (height > valleyParam.minHeight) + //¾«È·È·¶¨peakµã + int realPeakPos = preEdge; + for (int m = preEdge; m <= postEdge; m++) { - //¾«È·È·¶¨peakµã - int realPeakPos = preEdge; - for (int m = preEdge; m <= postEdge; m++) - { - if ((a_line[realPeakPos].pt3D.z < a_line[m].pt3D.z) && (a_line[m].nPointIdx >= 0)) - realPeakPos = m; - } - - SSG_basicFeatureGap a_valley; - memset(&a_valley, 0, sizeof(SSG_basicFeatureGap)); - a_valley.gapPeak.nPointIdx = realPeakPos; - a_valley.gapPeak.pt3D = a_line[realPeakPos].pt3D; - a_valley.gapPt_0.nPointIdx = edge_pos_pre; - a_valley.gapPt_0.pt3D = a_line[edge_pos_pre].pt3D; - a_valley.gapPt_1.nPointIdx = edge_pos_post; - a_valley.gapPt_1.pt3D = a_line[edge_pos_post].pt3D; - a_valley.lineIdx = lineIdx; - a_valley.gap_start = a_line[preEdge].pt3D.y; - a_valley.gap_width = width; - a_valley.gap_depth = height; - valleys.push_back(a_valley); + if ((a_line[realPeakPos].pt3D.z < a_line[m].pt3D.z) && (a_line[m].nPointIdx >= 0)) + realPeakPos = m; } + + SSG_basicFeatureGap a_valley; + memset(&a_valley, 0, sizeof(SSG_basicFeatureGap)); + a_valley.gapPeak.nPointIdx = realPeakPos; + a_valley.gapPeak.pt3D = a_line[realPeakPos].pt3D; + a_valley.gapPt_0.nPointIdx = edge_pos_pre; + a_valley.gapPt_0.pt3D = a_line[edge_pos_pre].pt3D; + a_valley.gapPt_1.nPointIdx = edge_pos_post; + a_valley.gapPt_1.pt3D = a_line[edge_pos_post].pt3D; + a_valley.lineIdx = lineIdx; + a_valley.gap_start = a_line[preEdge].pt3D.y; + a_valley.gap_width = width; + a_valley.gap_depth = height; + valleys.push_back(a_valley); + + buff[preEdge].peakState = USED; + buff[postEdge].peakState = USED; } } } - } + } } } + +//͹Æð¼ì²â£¨protrusion) +void _protrusionDetect( + std::vector& a_line, + const int lineIdx, const int startId, const int endId, + std::vector& deriv_1_peaks, + std::vector& deriv_2_peaks, + std::vector& deriv_1, + std::vector& deriv_2, + std::vector& valleys, + const SWD_valleyParam valleyParam) +{ + std::vector< posAttri> buff; + buff.resize(a_line.size()); + for (int i = 0; i < deriv_1_peaks.size(); i++) + buff[deriv_1_peaks[i].peakPos] = deriv_1_peaks[i]; + + double y_start = a_line[startId].pt3D.y; + double y_end = a_line[endId].pt3D.y; + + //°´peak£¨UP£©Öµ½øÐÐÅÅÐò + std::vector indexedPeaks; + for (int i = 0; i < deriv_2_peaks.size(); i++) + { + posAttri a_pos = deriv_2_peaks[i]; + if ((a_pos.peakState == UP) && (deriv_2[a_pos.peakPos] > 0)) + { + SWD_IndexedValue a_indexdPeak; + a_indexdPeak.idx = i; + a_indexdPeak.value = a_line[a_pos.peakPos].pt3D.z; + indexedPeaks.push_back(a_indexdPeak); + } + } + std::sort(indexedPeaks.begin(), indexedPeaks.end(), _sortFormZMinToMax); + + //Öð¸öpeak¼ì²â£ºÕýpeak + for (int i = 0; i < (int)indexedPeaks.size(); i++) + { + if (i == 153) + int kkk = 1; + int idx = indexedPeaks[i].idx; + posAttri a_pos = deriv_2_peaks[idx]; + + //¼ì²éÁ½²à + int preEdge = -1; + for (int j = a_pos.peakPos - 1; j > 0; j--) + { + if ( (buff[j].peakState == UP)|| (buff[j].peakState == USED)) + break; + else if (buff[j].peakState == DOWN) + { + if (deriv_1[j] < 0) + preEdge = j; + break; + } + } + int postEdge = -1; + for (int j = a_pos.peakPos + 1; j < (int)a_line.size(); j++) + { + if ( (buff[j].peakState == DOWN) || (buff[j].peakState == USED)) + break; + else if (buff[j].peakState == UP) + { + if (deriv_1[j] > 0) + postEdge = j; + break; + } + } + // + if ((preEdge >= 0) && (postEdge >= 0)) //³õ²½·ûºÏ͹ÆðÌØµã + { + float edge_value_pre = deriv_1[preEdge]; + float edge_value_post = deriv_1[postEdge]; + //¼ì²â¶Ô³ÆÐÔ + float min_value, max_value; + if ((-edge_value_pre) < edge_value_post) + { + min_value = -edge_value_pre; + max_value = edge_value_post; + } + else + { + max_value = -edge_value_pre; + min_value = edge_value_post; + } + if (min_value > max_value / 5) //2023.05.02: ·Å¿í¡£µ±°¼ÏÝÔÚÐ±ÃæÉÏʱ£¬²»ÔÙÊÇmaxValue/2µÄÀíÏëÇé¿ö + { + //¼ì²é°¼ÏÝ¿í¶ÈÉî¶È£¬Â˳ýÔëÉù + float th_pre = edge_value_pre * 0.5; + int edge_pos_pre = -1; + for (int j = preEdge; j >= 0; j--) + { + if ((deriv_1[j] >= th_pre) && (a_line[j].nPointIdx >= 0)) //·ÇÌî³äµã + { + edge_pos_pre = j; + break; + } + } + + float th_post = edge_value_post * 0.5; + int edge_pos_post = -1; + for (int j = postEdge; j < (int)a_line.size(); j++) + { + if ((deriv_1[j] <= th_post) && (a_line[j].nPointIdx >= 0)) //·ÇÌî³äµã + { + edge_pos_post = j; + break; + } + } + + //¼ì²â¿í¶È + if ((edge_pos_pre >= 0) && (edge_pos_post >= 0)) + { + //float width = a_line->m_p3DPositiont[edge_pos_post].pt3D.y - a_line->m_p3DPositiont[edge_pos_pre].pt3D.y; + float width = a_line[postEdge].pt3D.y - a_line[preEdge].pt3D.y; + if (width < valleyParam.maxWidth) + { + float height = _computeHeight(a_line[edge_pos_pre].pt3D, + a_line[edge_pos_post].pt3D, + a_line[a_pos.peakPos].pt3D); + if (height > valleyParam.minHeight) + { + //¾«È·È·¶¨peakµã + int realPeakPos = preEdge; + for (int m = preEdge; m <= postEdge; m++) + { + if ((a_line[realPeakPos].pt3D.z > a_line[m].pt3D.z) && (a_line[m].nPointIdx >= 0)) + realPeakPos = m; + } + + SSG_basicFeatureGap a_valley; + memset(&a_valley, 0, sizeof(SSG_basicFeatureGap)); + a_valley.gapPeak.nPointIdx = realPeakPos; + a_valley.gapPeak.pt3D = a_line[realPeakPos].pt3D; + a_valley.gapPt_0.nPointIdx = edge_pos_pre; + a_valley.gapPt_0.pt3D = a_line[edge_pos_pre].pt3D; + a_valley.gapPt_1.nPointIdx = edge_pos_post; + a_valley.gapPt_1.pt3D = a_line[edge_pos_post].pt3D; + a_valley.lineIdx = lineIdx; + a_valley.gap_start = a_line[preEdge].pt3D.y; + a_valley.gap_width = width; + a_valley.gap_depth = height; + valleys.push_back(a_valley); + + buff[preEdge].peakState = USED; + buff[postEdge].peakState = USED; + } + } + } + } + + } + } +} + /* Ö§³ÖÕ¤¸ñÊý¾Ý£¨ÒªÇóÊäÈëÕ¤¸ñÊý¾Ý£© */ //ÌáȡɨÃèÏßÉϵÄVÐÍValley void wd_getLineVFlaws( std::vector& a_line, const int lineIdx, const SWD_valleyParam valleyParam, + const EWD_FlawType detectFlawType, std::vector< SSG_basicFeatureGap>& valleys) { if (lineIdx == 286) @@ -10004,7 +10184,11 @@ void wd_getLineVFlaws( //ʹÓÃÕ­´°¿Ú //°¼ÏÝ£º¶þ½×µ¼Îª¼«Öµ£¬ÔÚ¼«ÖµµÄÁ½±ßÓÐÒ»¸ºÒ»ÕýµÄÒ»½×µ¼¼«Öµ¡£ //float innerPara_max_valley_width = 20.0; //ÄÚ²¿²ÎÊý¡£¿ØÖÆ×î´ó°¼Ïݼì²â¿í¶È£¬ÓÃÓÚ¹ýÂËÐé¼Ù°¼ÏÝ - _valleyDetect(a_line, lineIdx, startId, endId, deriv_1_peaks, deriv_2_peaks, deriv_1_narrow, deriv_2_narrow, valleys, valleyParam); + if(keWD_FlawType_Depression == detectFlawType) + _depressionDetect(a_line, lineIdx, startId, endId, deriv_1_peaks, deriv_2_peaks, deriv_1_narrow, deriv_2_narrow, valleys, valleyParam); + else if (keWD_FlawType_Protrusion == detectFlawType) + _protrusionDetect(a_line, lineIdx, startId, endId, deriv_1_peaks, deriv_2_peaks, deriv_1_narrow, deriv_2_narrow, valleys, valleyParam); + //else if (keSG_FlawType_Dep_Prot == detectFlawType) } diff --git a/sourceCode/SX_lapWeldDetection.cpp b/sourceCode/SX_lapWeldDetection.cpp index f71ae94..f8fefc6 100644 --- a/sourceCode/SX_lapWeldDetection.cpp +++ b/sourceCode/SX_lapWeldDetection.cpp @@ -7,7 +7,8 @@ //version 1.0.0 :º¸·ì£¨Æ½·ì£©Ê¶±ð¼ì²âËã·¨³õʼ·¢²¼ //version 1.1.0 :º¸·ì£¨Æ½·ì£©Ê¶±ðÐÞÕý»Ø¹é²âÊÔÖз¢ÏÖµÄbug -std::string m_strVersion = "weldSeamAlgo_1.1.0"; +//version 1.2.0 :º¸·ì£¨Æ½·ì£©Ê¶±ðÌí¼Ó²©ÇåÄ£ÄâÊý¾ÝÖеÄ͹Æðº¸·ì£¬Í¨¹ý²ÎÊýÑ¡Ôñʶ±ðÀàÐÍ£¨²»Ö§³Ö×Ô¶¯Ê¶±ð£© +std::string m_strVersion = "weldSeamAlgo_1.2.0"; const char* wd_weldSeamAlgoVersion(void) {