diff --git a/BaseModules/Hd_AI_algo_hanHou_L/Hd_AI_algo_hanHou.cpp b/BaseModules/Hd_AI_algo_hanHou_L/Hd_AI_algo_hanHou.cpp index 43380ec..98ccfc2 100644 --- a/BaseModules/Hd_AI_algo_hanHou_L/Hd_AI_algo_hanHou.cpp +++ b/BaseModules/Hd_AI_algo_hanHou_L/Hd_AI_algo_hanHou.cpp @@ -7,7 +7,9 @@ #include #include #include +#include using namespace cv; +QByteArray chartOKNG = "0";//0OK 1NG QByteArray silieResultText = "0"; QByteArray fanzheResultText = "0"; QByteArray jiErWidth = "0"; @@ -548,14 +550,25 @@ bool Hd_AI_algo_hanHou::readData(std::vector&vec_mat,QByteArray &data) //if (allNum++ % 2 == 0) // data = "2*3*2";// resByte.dequeue(); //else - data = "1*" + silieResultText + + "*" + fanzheResultText - + "*" + jiErWidth + "*" + jiErHeight - + "*" + hanYin1 + "*" + hanYin2 - +"&" + fanzheResultText + "&" + silieResultText - + "+" + fanzheResultText + "+" + silieResultText - + "+" + jiErWidth + "+" + jiErHeight - + "+" + hanYin1 + "+" + hanYin2 - ;//1OK,2NG + + //å�‘é€�到PLC的数æ�® + QByteArray resultCmd = resultCmdSplitStart + + silieResultText + +generalSplit + fanzheResultText + + generalSplit + jiErWidth + generalSplit + jiErHeight + + generalSplit + hanYin1 + generalSplit + hanYin2 + + resultCmdSplitEnd; + + //饼状图OKNG + QByteArray chartData = chartSplitStart + chartOKNG + chartSplitEnd;//应该å�ªæœ‰ä¸€ä¸ªæ•°æ�® 1OK 0NG + //缺陷直方图 + QByteArray defectData = defectSplitStart + fanzheResultText + generalSplit + silieResultText + defectSplitEnd;//0NG 1OK + //csv + QByteArray csvData = csvSplitStart + silieResultText + + generalSplit + fanzheResultText + generalSplit + silieResultText + + generalSplit + jiErWidth + generalSplit + jiErHeight + + generalSplit + hanYin1 + generalSplit + hanYin2 + csvSplitEnd; + + data = resultCmd + chartData + defectData + csvData; resByte.clear(); ////之å�Žæ ¹æ�®ç»“果类修改 //if(resIfNg == true) @@ -657,6 +670,7 @@ bool Hd_AI_algo_hanHou::writeData(std::vector& vec_mat, QByteArray &dat createDirectoryIfNotExists(oriImgSaveDir + getCurrentDate() + "//" + getCurrentHour() + "//"); addImgToSaveStruct(HikMat[0], "0",getOriSaveFromat());//ä¿�存原图 + if(HikMat.size() > 1) addImgToSaveStruct(HikMat[1], "0", getOriSaveFromat2());//ä¿�存原图 //if (!source_savePath.isEmpty()) //{ @@ -755,8 +769,8 @@ bool Hd_AI_algo_hanHou::initParas(QByteArray& byte) //StationNo = vec_ret.at(0).toInt(); - seg_hanHouSiLie = handdleAI::CreateSegObjS("./model/seg-yuHanhanHouSiLie.BHD", 32, 0); - seg_hanHouFanZhe = handdleAI::CreateSegObjS("./model/seg-yuHanhanFanZhe.BHD", 32, 0); + //seg_hanHouSiLie = handdleAI::CreateSegObjS("./model/seg-yuHanhanHouSiLie.BHD", 32, 0); + //seg_hanHouFanZhe = handdleAI::CreateSegObjS("./model/seg-yuHanhanFanZhe.BHD", 32, 0); //InitThreads(StationNo, img2D); //InitModels(StationNo, img2D); @@ -924,7 +938,7 @@ bool Hd_AI_algo_hanHou::AIdetect(cv::Mat img2D, QString mysaveKey, QString myDir { try { - + return true; //存图数æ�®åŠ ä¿�存队列,加é”�,é�¿å…�æ•°æ�®è®¿é—®å†²çª� saveStruct_mutex->lock(); diff --git a/BaseModules/Hd_CameraModule_HIK_soft_TakeTwo/Hd_CameraModule_HIK_soft.cpp b/BaseModules/Hd_CameraModule_HIK_soft_TakeTwo/Hd_CameraModule_HIK_soft.cpp index 423d8d9..4b8de2e 100644 --- a/BaseModules/Hd_CameraModule_HIK_soft_TakeTwo/Hd_CameraModule_HIK_soft.cpp +++ b/BaseModules/Hd_CameraModule_HIK_soft_TakeTwo/Hd_CameraModule_HIK_soft.cpp @@ -94,6 +94,12 @@ bool IsColor(MvGvspPixelType enType) return false; } } +void SetExposureTime(float exposureValue) +{ + qDebug() << "[INFO] " << "exposureValue:" << exposureValue; + MV_CC_SetEnumValue(handle, "ExposureAuto", MV_EXPOSURE_AUTO_MODE_OFF); + MV_CC_SetFloatValue(handle, "ExposureTime", exposureValue); +} //æ�œç´¢æ‰€æœ‰è®¾å¤‡ int SearchDevice() @@ -330,13 +336,6 @@ void __stdcall ImageCallBackEx(unsigned char* pData0, MV_FRAME_OUT_INFO_EX* pFra cv::imwrite(savePath.toStdString(), resizeS);*/ } -void SetExposureTime(float exposureValue) -{ - qDebug() << "[INFO] " << "exposureValue:" << exposureValue; - MV_CC_SetEnumValue(handle, "ExposureAuto", MV_EXPOSURE_AUTO_MODE_OFF); - MV_CC_SetFloatValue(handle, "ExposureTime", exposureValue); -} - void SetGain(float GainValue) { qDebug() << "[INFO] " << "GainValue:" << GainValue; diff --git a/BaseModules/Hd_LogicDll_module/CMakeLists.txt b/BaseModules/Hd_LogicDll_module/CMakeLists.txt index 9f697ac..b935737 100644 --- a/BaseModules/Hd_LogicDll_module/CMakeLists.txt +++ b/BaseModules/Hd_LogicDll_module/CMakeLists.txt @@ -4,7 +4,7 @@ string(TIMESTAMP RUN_TIME) message( " model start : " ${CURRENT_FOLDER}:${RUN_TIME}) -set(DLL_NAMES "opencv" "qt5") +set(DLL_NAMES "opencv" "qt5" "myTools") foreach(child ${DLL_NAMES}) LIST(APPEND ENV_INCLUDE ${${child}_include}) LIST(APPEND ENV_LIB ${${child}_lib}) diff --git a/BaseModules/Hd_LogicDll_module/Logic_taskthread.cpp b/BaseModules/Hd_LogicDll_module/Logic_taskthread.cpp index 55023b0..42bed7e 100644 --- a/BaseModules/Hd_LogicDll_module/Logic_taskthread.cpp +++ b/BaseModules/Hd_LogicDll_module/Logic_taskthread.cpp @@ -1,5 +1,5 @@ #include "Logic_taskthread.h" - +#include //图åƒ�é”�ã€�通信指令é”� void Logic_taskthread::setMutex(QMutex* image_lock, QMutex* write_mutex) { if (m_image_lock == nullptr) @@ -810,7 +810,13 @@ bool Logic_taskthread::deleteSnData ( QByteArray byteArray, QVector& sn // 算法结果 写入plc bool Logic_taskthread::writeAiCommond ( QString cameraName,QString camera_name_index,QByteArray byteArray ) { - QByteArrayList PLCvec_ret= byteArray.split('*'); // 存储结果的 + std::string str = byteArray.toStdString(); + int start = str.find(resultCmdSplitStart) + std::size(resultCmdSplitStart)-1; + int end = str.find(resultCmdSplitEnd)- start; + if (end > 0 && start > 0) + str = str.substr(start,end); + //char split = *generalSplit; + QByteArrayList PLCvec_ret= QByteArray::fromStdString(str).split(*generalSplit); // 存储结果的 if (PLCvec_ret.isEmpty() ) { diff --git a/HanddleAI/CMakeLists.txt b/HanddleAI/CMakeLists.txt index 7e139b4..dcc066f 100644 --- a/HanddleAI/CMakeLists.txt +++ b/HanddleAI/CMakeLists.txt @@ -13,7 +13,7 @@ foreach(dll ${OUR_LIBS}) endforeach(dll ${}) -set(DLL_NAMES "halcon" "opencv" "json" "handdleAI") +set(DLL_NAMES "halcon" "opencv" "json" "handdleAI" "myTools") foreach(child ${DLL_NAMES}) LIST(APPEND ENV_INCLUDE ${${child}_include}) LIST(APPEND ENV_LIB ${${child}_lib}) diff --git a/HanddleAI/Qt_epWindow.cpp b/HanddleAI/Qt_epWindow.cpp index c7745e9..31a3921 100644 --- a/HanddleAI/Qt_epWindow.cpp +++ b/HanddleAI/Qt_epWindow.cpp @@ -1,6 +1,7 @@ #include "Qt_epWindow.h" #include "qapplication.h" #include +#include #pragma execution_character_set("utf-8") clock_t pressStart, pressStop; @@ -1803,6 +1804,24 @@ void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInf int mm = nowTime.split(" ")[1].split(":")[1].toInt(); if ((hh > 8 && hh < 20) || (hh == 8 && mm >= 30) || (hh == 20 && mm < 30)) ifNight = false; + + std::string str = byteArray.toStdString(); + std::string chartData, csvData, defectData; + //CHART表格数æ�® + int startChart = str.find(chartSplitStart) + std::size(chartSplitStart) - 1; + int endChart = str.find(chartSplitEnd) - startChart; + if (startChart > 0 && endChart > 0) + chartData = str.substr(startChart, endChart); + //CSV表格数æ�® + int startCSV = str.find(csvSplitStart) + std::size(csvSplitStart) - 1; + int endCSV = str.find(csvSplitEnd) - startCSV; + if (startCSV > 0 && endCSV > 0) + csvData = str.substr(startCSV, endCSV); + //缺陷直方图 + int startDefect = str.find(csvSplitStart) + std::size(csvSplitStart) - 1; + int endDefect = str.find(csvSplitEnd) - startDefect; + if (startDefect > 0 && endDefect > 0) + defectData = str.substr(startDefect, endDefect); if (key.contains("程åº�å�·")) { cName_surface_defectNums.clear(); @@ -1843,10 +1862,12 @@ void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInf set_tabQPushButton(0); //waiteBox-> close(); } - else if (myByte.contains("*") )//|| CommunicationProcessLevel==1) //简å�•æµ�程æ¯�张图就是结果 + if (chartData.size() > 0)//|| CommunicationProcessLevel==1) //简å�•æµ�程æ¯�张图就是结果 { + int result = stoi(chartData); + QPieSeriesData_ALL.allNum++; - if (myByte.contains("1*") || (CommunicationProcessLevel==1 && myByte=='1')) + if (result == 1) { myByte = "OK"; setInsertTextColor(ui.plainTextEdit_history, QColor("green")); @@ -1869,13 +1890,12 @@ void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInf if (historyLogList.size() > 100000) historyLogList.dequeue(); ui.plainTextEdit_history->appendPlainText(historyLogList.last()); - //实时信æ�¯ { ui.label_result->setText(myByte); ui.label_SN->setText(snInfo); ui.label_allNum->setText(QString::number(QPieSeriesData_ALL.allNum)); - ui.label_OKPercent->setText(QString::number(int(QPieSeriesData_ALL.okNum*1.0000 / QPieSeriesData_ALL.allNum * 10000) / 100.00) + "%"); + ui.label_OKPercent->setText(QString::number(int(QPieSeriesData_ALL.okNum * 1.0000 / QPieSeriesData_ALL.allNum * 10000) / 100.00) + "%"); ui.label_OKNum->setText(QString::number(QPieSeriesData_ALL.okNum)); ui.label_NGnum->setText(QString::number(QPieSeriesData_ALL.ngNum));; //百万级å�˜è´Ÿæ•°ï¼Ÿï¼Ÿ if (QPieSeriesData_ALL.allNum > 1) @@ -1888,12 +1908,11 @@ void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInf } start = clock(); } - //饼图更新 { //ALL饼图;slices()[0] ok;slices()[1] ng; QPieSeriesData_ALL.series->slices()[0]->setValue(int(QPieSeriesData_ALL.okNum * 1.0000 / QPieSeriesData_ALL.allNum * 10000) / 100.00); - QPieSeriesData_ALL.series->slices()[1]->setValue(100.00- int(QPieSeriesData_ALL.okNum * 1.0000 / QPieSeriesData_ALL.allNum * 10000) / 100.00); + QPieSeriesData_ALL.series->slices()[1]->setValue(100.00 - int(QPieSeriesData_ALL.okNum * 1.0000 / QPieSeriesData_ALL.allNum * 10000) / 100.00); //æ�¢ç�­åˆ¤æ–­ if (ifLastNight != ifNight) @@ -1925,7 +1944,7 @@ void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInf if (ifNight) { QPieSeriesData_night.allNum++; - if(myByte=="OK") + if (myByte == "OK") QPieSeriesData_night.okNum++; else if (myByte == "NG") QPieSeriesData_night.ngNum++; @@ -1975,11 +1994,10 @@ void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInf rowNumn++; } } - //更新缺陷统计表图 - if (myByteCpy.contains("&")) //æ ¼å¼�为:忽略段&缺陷类型1的是å�¦æœ‰ç¼ºé™·æ ‡å¿—&缺陷类型2的是å�¦æœ‰ç¼ºé™·æ ‡å¿—... + if(defectData.size() > 0) { - QStringList myByteList = myByteCpy.split("&"); + QStringList myByteList = myByteCpy.split(*generalSplit); if (myByteList.size() > 1) for (int i = 1; i < myByteList.size(); i++) { @@ -2089,11 +2107,11 @@ void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInf } //写表格CSV - if (myByteCpy.contains("+")) + if (csvData.size()>0) { QString ymd = QDateTime::currentDateTime().toString("yyyy-MM-dd"); QString hms = QDateTime::currentDateTime().toString("hh:mm:ss"); - QStringList outDataList = myByteCpy.split("+"); + QStringList outDataList = myByteCpy.split(*generalSplit); std::vector strList; strList.push_back(hms.toStdString());// æ—¶é—´ strList.push_back(snInfo.toStdString());//SN diff --git a/env/halconAlgo/dll/Inspection.dll b/env/halconAlgo/dll/Inspection.dll index f906aa3..45d68bb 100644 Binary files a/env/halconAlgo/dll/Inspection.dll and b/env/halconAlgo/dll/Inspection.dll differ diff --git a/env/halconAlgo/include/algo.h b/env/halconAlgo/include/algo.h index 892636f..5426ad7 100644 --- a/env/halconAlgo/include/algo.h +++ b/env/halconAlgo/include/algo.h @@ -28,11 +28,13 @@ extern "C" __declspec(dllexport) void _stdcall _628_1_Polarity_detection(HObject *hv_Out_Roboot1£ºÎü×ì1-> Îü×ì±àºÅ,x¾ø¶Ô×ø±ê£¬y¾ø¶Ô×ø±ê * hv_Out_Roboot2£ºÎü×ì2->Îü×ì±àºÅ£¬x¾ø¶Ô×ø±ê£¬y¾ø¶Ô×ø±ê * hv_Out_Roboot3£ºÎü×ì3->Îü×ì±àºÅ£¬x¾ø¶Ô×ø±ê£¬y¾ø¶Ô×ø±ê +* hv_StartRun: 1Æô¶¯Õñ¶¯ÅÌ£¬2²»Æô¶¯Õñ¶¯ÅÌ * »úÆ÷ÈËÒýµ¼º¯Êý * ÈýЭ»ų́ */ -extern "C" __declspec(dllexport) void _stdcall _628_BootTheMachine(HObject ho_Image, HTuple hv_NinePointDocument, HTuple hv_SetNumber, - HTuple* hv_Circle_Point, HTuple* hv_Make, HTuple* hv_Out_Roboot1, HTuple* hv_Out_Roboot2,HTuple* hv_Out_Roboot3); +extern "C" __declspec(dllexport) void _stdcall _628_BootTheMachine(HObject ho_Image, HTuple hv_NinePointDocument, HTuple hv_SetNumber, + HTuple* hv_Circle_Point, HTuple* hv_Make, HTuple* hv_Out_Roboot1, HTuple* hv_Out_Roboot2, + HTuple* hv_Out_Roboot3, HTuple* hv_StartRun); /* *ho_Image£ºÊäÈëͼƬ£¨Ô­Í¼£© @@ -47,6 +49,23 @@ extern "C" __declspec(dllexport) void _stdcall _628_BootTheMachine(HObject ho_Im extern "C" __declspec(dllexport) void _stdcall cs_628_jier_T(HObject ho_Image, HTuple hv_Pix, HTuple* hv_out_line, HTuple* hv_out_Soldering_line, HTuple* hv_distance, HTuple* hv_Make); +/* +*ho_Image£ºÊäÈëͼƬ£¨Ô­Í¼£© +* hv_Pix£ºÏñËØ¾«¶È +* hv_out_line:Êä³öÖ±Ïß×ø±ê +* hv_distance£ºÊä³ö²âÁ¿Öµ ->¸ß£¬¿í¡£Êý×éÐÎʽ +* hv_Make£ºÊä³ö-1ΪËã·¨´íÎó£¬Êä³ö1ΪËã·¨Õý³£Ö´ÐÐ +* ÂÁ¼«¶ú²Ã¼ô²âÁ¿º¯Êý +* ÈýЭԤº¸»ų́ +*/ + +extern "C" __declspec(dllexport) void _stdcall cs_628_jier_L(HObject ho_Image, HTuple hv_Pix, HTuple* hv_out_line, HTuple* hv_distance, + HTuple* hv_Make); + + + + + /* @@ -70,7 +89,7 @@ extern "C" __declspec(dllexport) void _stdcall _628_NailingPosition(HObject ho_I /* ho_Image:ÊäÈëԭͼ - hv_out_Value£ºÊä³ö¼ì²â½á¹û[1,1] .1ΪÂÁ£¬[2,2] 2Ϊͭ + hv_out_Value£ºÊä³ö¼ì²â½á¹û[1,1] .1ΪÂÁ£¬[2,2] 2Ϊͭ ,0ΪÎÞÁÏ hv_Make£ºËã·¨Ö´ÐÐ״̬-1ΪËã·¨NG£¬1ΪËã·¨ok ¼«ÐÔ¼ì²âº¯Êý ÖÕº¸ÈýЭ»ų́ @@ -139,9 +158,52 @@ extern "C" __declspec(dllexport) void _stdcall _628_AfterWelding_Distance_T(HObj HTuple* hv_Out_TopRight_Value, HTuple* hv_Out_BottomLeft_Line, HTuple* hv_Out_BottomLeft_Value, HTuple* hv_Out_BottomRight_Line, HTuple* hv_Out_BottomRight_Value, HTuple* hv_Make); +/* +* ho_Image £ºÊäÈëͼƬ +* hv_Out_Rectangle : Êä³ö¾ØÐεÄÁ½¸ö¶¥µã×ø±ê +* hv_Text £ºÊä³ö¼ì²âÐÅÏ¢×Ö·û´®¸ñʽ +* hv_Make£ºÊä³ö-1ΪËã·¨´íÎó£¬Êä³ö1ΪËã·¨Õý³£Ö´ÐÐ +*ÈíÁ¬½ÓÈÈÈÛ¹¤Î»º¯Êý +* ÈýЭµÄ»ų́ +*/ +extern "C" __declspec(dllexport) void _stdcall _628_3_TopCoverMelted(HObject ho_Image, HTuple* hv_Out_Rectangle, HTuple* hv_Make, + HTuple* hv_Text); +/* +* ho_Image_L £ºÊäÈëͼƬ£¨ÂÁ£© +* ho_Image_T £ºÊäÈëͼƬ£¨Í­£© +* hv_Pix_L £ºÂÁ¼«Ïà»úÏñËØ¾«¶È +* hv_Pix_T £ºÍ­¼«Ïà»úÏñËØ¾«¶È +* hv_Out_Line_T £ºÍ­¼«Êä³öÏߵĶ˵ã×ø±ê£¨ÐèÅжϸöÊý£© +* hv_Out_Point_T £ºÍ­¼«Êä³öÖÐÐÄÔ²µÄÖÐÐÄ×ø±ê¼°°ë¾¶ +* hv_Out_Chamfering_T £ºÍ­¼«Êä³öµ¹½ÇÖµ +* hv_Distances_T £ºÍ­¼«Êä³öÉÏÏ£¬×óÓÒ¾àÀë +* hv_Out_Line_L £ºÂÁ¼«Êä³öÏߵĶ˵ã×ø±ê£¨ÐèÅжϸöÊý£© +* hv_Out_Point_L £ºÂÁ¼«Êä³öÖÐÐÄÔ²µÄÖÐÐÄ×ø±ê¼°°ë¾¶ +* hv_Out_Chamfering_L £ºÂÁ¼«Êä³öµ¹½ÇÖµ +* hv_Distances_L £ºÂÁ¼«Êä³öÉÏÏ£¬×óÓÒ¾àÀë +* hv_Out_InterpoleValue £ºÊä³öÁ½¼«ÖùÖ®¼ä¾àÀë +* hv_Makes£ºÊä³ö-1ΪËã·¨´íÎó£¬Êä³ö1ΪËã·¨Õý³£Ö´ÐÐ +*ÈíÁ¬½Ó¼«Öù²âÁ¿¹¤Î»º¯Êý +* ÈýЭµÄ»ų́ +*/ +extern "C" __declspec(dllexport) void _stdcall _628_3_PoleDetections(HObject ho_Image_L, HObject ho_Image_T, HTuple hv_Pix_L, + HTuple hv_Pix_T, HTuple* hv_Out_Line_T, HTuple* hv_Out_Point_T, HTuple* hv_Out_Chamfering_T, + HTuple* hv_Distances_T, HTuple* hv_Out_Line_L, HTuple* hv_Out_Point_L, HTuple* hv_Out_Chamfering_L, + HTuple* hv_Distances_L, HTuple* hv_Out_InterpoleValue, HTuple* hv_Makes); +/* +* ho_Image £ºÊäÈëͼƬ +* hv_Pix £ºÏà»úÏñËØ¾«¶È +* hv_Distance_Value £º¼ä¾à²âÁ¿Öµ +* hv_Out_Point £ºÊä³ö·À±¬·§ÖÐÐĵãºÍ¶þάÂëÖÐÐĵã¾àÀë +* hv_Makes£ºÊä³ö-1ΪËã·¨´íÎó£¬Êä³ö1ΪËã·¨Õý³£Ö´ÐÐ +*ÈíÁ¬½Ó·À±¬·§Óë¶þάÂëÖ®¼ä¾àÀë²âÁ¿º¯Êý +* ÈýЭµÄ»ų́ +*/ +extern "C" __declspec(dllexport) void _stdcall _628_3_ExplosionProofValves(HObject ho_Image, HTuple hv_Pix, HTuple* hv_Distance_Value, + HTuple* hv_Out_Point, HTuple* hv_Make); @@ -225,6 +287,60 @@ extern "C" __declspec(dllexport) void _stdcall _628_25D(HObject ho_Image1, HObje HObject* ho_Out_Image1, HObject* ho_Out_image2, HTuple hv_sacats, HTuple hv_Tilts, HTuple* hv_Make); +//Function Name: Cal_Defect_Height +//Author: +//Description: 2D»ñȡȱÏݺó, »ùÓÚÌØÕ÷µãµÄλÖùØÏµ, ½¨Á¢2DºÍ3DµÄÓ³Éä¹ØÏµ. +//Input: in_Image2: ÃÜ·â¶¤ÇøÓòµÄ2D¶þÖµ»¯µÄͼÏñ(bmp),, +// in_Image3: 3DÉî¶ÈͼÏñ(tiff), +// in_xResolution: xÏò¾«¶È(mm/pix) +// in_yResolution: yÏò¾«¶È(mm/pix), +// in_zResolution: ZÏò¾«¶È(mm/pix) +// in_DefectLocation: 2dͼÏñȱÏÝ×ø±êµãλÖÃ, ÿËĸöÒ»×é, +// in_DefectLocation[0]:ȱÏÝÍâ½Ó¾ØÐεÄXÏò×ø±ê(pix) +// in_DefectLocation[1]:ȱÏÝÍâ½Ó¾ØÐεÄyÏò×ø±ê(pix) +// in_DefectLocation[2]:ȱÏÝÍâ½Ó¾ØÐεĿí¶Èwidth(pix) +// in_DefectLocation[3]:ȱÏÝÍâ½Ó¾ØÐεĸ߶Èheight(pix) +// in_FilePath, ¾ØÕómartixÎļþ·¾¶, +// in_offsetValue, λÖò¹³¥Öµ, +// in_offsetValue[0]: ×ó¹¤Î»XÏò²¹³¥Öµ(pix) +// in_offsetValue[1]: ×ó¹¤Î»YÏò²¹³¥Öµ(pix) +// in_offsetValue[2]: ÓÒ¹¤Î»XÏò²¹³¥Öµ(pix) +// in_offsetValue[3]: ÓÒ¹¤Î»YÏò²¹³¥Öµ(pix) +// in_HoffsetValue, ȱÏݸ߶Ȳ¹³¥Öµ(ÕýÖµ,µ¥Î»:mm) +//output£º out_Height: ȱÏݵĸ߶È(mm), +// out_Flag: Ëã·¨Ö´Ðеıê־λ, 0: Ëã·¨Ö´ÐÐÒì³£ 1:Ëã·¨Ö´ÐÐok +// Ó®ºÏ»ų́ +//verion change log: XXX 2024-10-22 V1.1 Create new function + +extern "C" __declspec(dllexport) void _stdcall Cal_Defect_Height(HObject ho_in_Image2, HObject ho_in_Image3, HTuple hv_in_xResolution, + HTuple hv_in_yResolution, HTuple hv_in_zResolution, HTuple hv_in_DefectLocation, + HTuple hv_in_FilePath, HTuple hv_in_OffsetValue, HTuple hv_in_HoffsetValue, HTuple* hv_out_Height, + HTuple* hv_out_Angle, HTuple* hv_out_Flag); + +//********************************************************************** +//Function Name: Cal_Long_Coatingcover_Dist +//Author: +//Description: ¼ÆËãĤµ½¶Ë¸ÇµÄ¾àÀë, +//Input(HObject): in_Image,Â˲¨´¦ÀíºóµÄ×¥±ßͼÏñ +//Input(HTuple): in_Resolution, Ïà»ú¾«¶È(mm/pix) +//output(HTuple): out_Maxdistance, Ĥµ½¶Ë¸ÇµÄ×î´ó¾àÀë(mm) +// out_Mindistance, Ĥµ½¶Ë¸ÇµÄ×îС¾àÀë(mm) +// out_Line, »ù×¼ÏßλÖÃ(x1,y1,x2,y2) +// out_X, ĤµÄxµã×ø±ê¼¯ +// out_Y, ĤµÄyµã×ø±ê¼¯ +// out_Flag: Ö´Ðгɹ¦Î»±êʶ 1, Ëã·¨Ö´Ðгɹ¦ 2, Ëã·¨Ö´ÐÐng +// out_NgTails: NGµÄÃ÷ϸ +//verion change log: ºúºº±ø 2024-07-11 V1.1 Create new function . +//********************************************************************** + +extern "C" __declspec(dllexport) void _stdcall Cal_Long_Coatingcover_Dist(HObject ho_in_Image, HTuple hv_in_Resolution, HTuple* hv_out_Maxdistance, + HTuple* hv_out_Mindistance, HTuple* hv_out_Line, HTuple* hv_out_X, HTuple* hv_out_Y, + HTuple* hv_out_Flag, HTuple* hv_out_Ngtails); + + + + + #endif @@ -264,6 +380,22 @@ void BeforeWelding_T(HObject ho_Image_T, HTuple hv_Pix_T, HTuple* hv_Make, HTupl HTuple* hv_Out_Vale, HTuple* hv_Out_PointRow, HTuple* hv_Out_PointCol); +void Cal_PointCould_HeightValue(HObject ho_Tmp_Region, HObject ho_Zero_Region, HObject ho_XImageScaled, + HObject ho_YImageScaled, HObject ho_ZImageScaled, HTuple hv_HeightPointPerenct, + HTuple* hv_Out_Mean, HTuple* hv_Out_Max, HTuple* hv_Out_Min, HTuple* hv_Out_Height, + HTuple* hv_Out_Flag, HTuple* hv_Out_NgTails); + +void cs_628_PoleDetection(HObject ho_Image, HTuple hv_Pix, HTuple* hv_Distances, + HTuple* hv_UP_Down_Point, HTuple* hv_life_Ren_Point, HTuple* hv_Point, HTuple* hv_Chamfering, + HTuple* hv_Make); + +void Get_Rectangle2_Corner(HObject ho_Rectangle, HTuple* hv_out_Row, HTuple* hv_out_Col); + +void Get_LineParameters(HObject ho_in_Image, HObject* ho_out_Contour, HTuple hv_in_Parameters, + HTuple* hv_out_Parameters, HTuple* hv_out_Flag, HTuple* hv_out_NgTails); + +void rake1(HObject ho_Image, HObject * ho_Regions, HTuple hv_InParameters, HTuple * hv_ResultRow, + HTuple * hv_ResultColumn); #endif diff --git a/env/halconAlgo/lib/Inspection.lib b/env/halconAlgo/lib/Inspection.lib index a0ce9b4..7b0cf70 100644 Binary files a/env/halconAlgo/lib/Inspection.lib and b/env/halconAlgo/lib/Inspection.lib differ diff --git a/env/myTools/include/global.h b/env/myTools/include/global.h new file mode 100644 index 0000000..4bcd134 --- /dev/null +++ b/env/myTools/include/global.h @@ -0,0 +1,10 @@ +#define resultCmdSplitStart "[resultCmdSplitStart]" +#define resultCmdSplitEnd "[resultCmdSplitEnd]" +#define defectSplitStart "[defectSplitStart]" +#define defectSplitEnd "[defectSplitEnd]" +#define chartSplitStart "[chartSplitStart]" +#define chartSplitEnd "[chartSplitEnd]" +#define csvSplitStart "[csvSplitStart]" +#define csvSplitEnd "[csvSplitEnd]" +#define generalSplit "|" +//SAMPLE \ No newline at end of file