From a68073a77792dc96cecbfb79693d531bc51ebbac Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 08 八月 2025 18:01:35 +0800
Subject: [PATCH] 1. 修复保存图片分配率问题 2. 修复获取相机配置的问题 3. 添加侧面检的视觉模块
---
EdgeInspector_App/InterfaceManager.cpp | 10 ++++-
EdgeInspector_App/stdafx.h | 8 ++++
EdgeInspector_App/MainFrm.cpp | 2 -
EdgeInspector_App/EdgeInspector_AppView.cpp | 4 +-
EdgeInspector_App/View/ViewMain_ScanImage.cpp | 48 +++++++----------------
EdgeInspector_App.sln | 10 +++++
6 files changed, 43 insertions(+), 39 deletions(-)
diff --git a/EdgeInspector_App.sln b/EdgeInspector_App.sln
index 55fb25a..900def7 100644
--- a/EdgeInspector_App.sln
+++ b/EdgeInspector_App.sln
@@ -35,6 +35,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AutoFileCleanupTool", "Common_Class\AutoFileCleanupTool\AutoFileCleanupTool.vcxproj", "{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VisionMeasure", "VisionMeasure\VisionMeasure.vcxproj", "{52480DCD-7CDE-4608-B432-1DF92C6F29D6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -143,6 +145,14 @@
{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}.Release|Win32.Build.0 = Release|Win32
{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}.Release|x64.ActiveCfg = Release|x64
{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}.Release|x64.Build.0 = Release|x64
+ {52480DCD-7CDE-4608-B432-1DF92C6F29D6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {52480DCD-7CDE-4608-B432-1DF92C6F29D6}.Debug|Win32.Build.0 = Debug|Win32
+ {52480DCD-7CDE-4608-B432-1DF92C6F29D6}.Debug|x64.ActiveCfg = Debug|x64
+ {52480DCD-7CDE-4608-B432-1DF92C6F29D6}.Debug|x64.Build.0 = Debug|x64
+ {52480DCD-7CDE-4608-B432-1DF92C6F29D6}.Release|Win32.ActiveCfg = Release|Win32
+ {52480DCD-7CDE-4608-B432-1DF92C6F29D6}.Release|Win32.Build.0 = Release|Win32
+ {52480DCD-7CDE-4608-B432-1DF92C6F29D6}.Release|x64.ActiveCfg = Release|x64
+ {52480DCD-7CDE-4608-B432-1DF92C6F29D6}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/EdgeInspector_App/EdgeInspector_AppView.cpp b/EdgeInspector_App/EdgeInspector_AppView.cpp
index 4b88969..fa2dcff 100644
--- a/EdgeInspector_App/EdgeInspector_AppView.cpp
+++ b/EdgeInspector_App/EdgeInspector_AppView.cpp
@@ -427,7 +427,7 @@
if(m_pViewScanImage == NULL)
return;
- for(iCam=0;iCam<MAX_PANEL_SIDE;iCam++)
+ for (iCam = 0; iCam < MAX_CAMERA_COUNT; iCam++)
{
CCameraSettings *pCamera = &m_pHardwareSetting->m_pCameraSettings[iCam*2]; //GetCameraSettings(iCam,0);
if(pCamera == NULL)
@@ -447,7 +447,7 @@
if(m_pViewScanImage == NULL)
return;
- for(iCam=0;iCam<MAX_PANEL_SIDE;iCam++)
+ for (iCam = 0; iCam < MAX_CAMERA_COUNT; iCam++)
{
CCameraSettings *pCamera = &m_pHardwareSetting->m_pCameraSettings[iCam*2]; //m_pHardwareSetting->GetCameraSettings(iCam,0);
if(pCamera == NULL)
diff --git a/EdgeInspector_App/InterfaceManager.cpp b/EdgeInspector_App/InterfaceManager.cpp
index 86bd20c..92fd985 100644
--- a/EdgeInspector_App/InterfaceManager.cpp
+++ b/EdgeInspector_App/InterfaceManager.cpp
@@ -1825,7 +1825,13 @@
strSavePath += _T(".jpg");
Lock();
- FIBITMAP* bitmap = FreeImage_Allocate(IMAGE_WIDTH, nLineCnt, 8);
+ FIBITMAP* bitmap = nullptr;
+ int nImageWidth = IMAGE_WIDTH;
+ if (iSide > DIMENSION_D_DN) {
+ nImageWidth = IMAGE_WIDTH / 2;
+ }
+ bitmap = FreeImage_Allocate(nImageWidth, nLineCnt, 8);
+
if (bitmap == NULL) {
Unlock();
return FALSE;
@@ -1844,7 +1850,7 @@
return FALSE;
}
- CopyMemory(pBitBuffer, lpImg, IMAGE_WIDTH * nLineCnt);
+ CopyMemory(pBitBuffer, lpImg, nImageWidth * nLineCnt);
USES_CONVERSION;
char str_filename[1024];
diff --git a/EdgeInspector_App/MainFrm.cpp b/EdgeInspector_App/MainFrm.cpp
index 61450a6..1759aa9 100644
--- a/EdgeInspector_App/MainFrm.cpp
+++ b/EdgeInspector_App/MainFrm.cpp
@@ -338,8 +338,6 @@
SetSlashText(GLOBAL_DEFINE::emShow, _T(""), RGB(0,0,0));
- //SetSlashText(GLOBAL_DEFINE::emText, _T("Image Save Start"), RGB(0,0,0));
-
BOOL bRet = SaveFullImage(strPath, iSide, ptStart, nLength);
SetSlashText(GLOBAL_DEFINE::emText, strPath, RGB(0,0,0));
diff --git a/EdgeInspector_App/View/ViewMain_ScanImage.cpp b/EdgeInspector_App/View/ViewMain_ScanImage.cpp
index 1e953b6..b20660d 100644
--- a/EdgeInspector_App/View/ViewMain_ScanImage.cpp
+++ b/EdgeInspector_App/View/ViewMain_ScanImage.cpp
@@ -316,12 +316,13 @@
BYTE* CViewMain_ScanImage::GetBufferPoint(int nViewIndex,int nPos /*= 0*/)
{
BYTE *add = NULL;
- int nIdx_Side = GetSideIdx(nViewIndex);
+ int nIdx_Side = GetSideIdx(nViewIndex);
LPBYTE plpBuf = NULL;
- if(m_IV2M != NULL)
- plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)nIdx_Side,nPos);
-
+ if (m_IV2M != NULL) {
+ plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)nIdx_Side, nPos);
+ }
+
return plpBuf;
}
@@ -330,8 +331,7 @@
PROG_MSG MsgJob = *((PROG_MSG*)wParam);
int nIndex = GetViewIndex(MsgJob.nSide);
- if(MsgJob.nState == 2)
- {
+ if(MsgJob.nState == 2) {
InitScrollInfo(MsgJob.nSide,1);
m_ctrlScrollV[nIndex].EnableWindow(TRUE);
@@ -355,23 +355,7 @@
m_frameImg[nIndex].SetGlassData(m_pGlassData);
m_frameImg[nIndex].Invalidate();
}
- else
- {
- /*
- if(fabs(m_dZoom - 1.) > 0.01)
- {
- m_dZoom = 0.2;
- m_sliderZoom.SetPos(0);
-
- CString strTmp;
- strTmp.Format(_T("X %.2f"),m_dZoom);
- GetDlgItem(IDC_ST_ZOOM)->SetWindowText(strTmp);
-
- UpdateZoom();
- }
- */
-
- //g_pLog->DisplayMessage(_T("Frame Display %d"),nIndex);
+ else {
CPoint ptOrg = m_frameImg[nIndex].GetDisplayPos();
ptOrg.y = MsgJob.nDispLine;
@@ -385,7 +369,7 @@
void CViewMain_ScanImage::SetupImageSave()
{
- ManualThreadStart(M_CMD_IMG_SAVE_ALL,-1);
+ ManualThreadStart(M_CMD_IMG_SAVE_ALL, -1);
}
void CViewMain_ScanImage::SetRecipe(CHardwareSettings *pHW)
@@ -395,10 +379,9 @@
void CViewMain_ScanImage::ResetView()
{
- for(int i = 0; i < MAX_PANEL_SIDE * UPDN_TYPE; i++)
- {
+ for(int i = 0; i < MAX_PANEL_SIDE * UPDN_TYPE; i++) {
m_ctrlScrollV[i].EnableWindow(FALSE);
- }
+ }
}
void CViewMain_ScanImage::ViewRefresh(PROG_MSG ProcMsg)
@@ -1030,8 +1013,8 @@
if (NULL == pGlassRcp) return;
#endif
- CString strRcpName = pGlassRcp->GetRecipeName();
- CString strGlassID = g_pBase->m_strHPanelID;
+ CString strRcpName = pGlassRcp->GetRecipeName();
+ CString strGlassID = g_pBase->m_strHPanelID;
if(strGlassID.IsEmpty() == TRUE) {
strGlassID = _T("Manual_ID");
@@ -1099,11 +1082,10 @@
if(nLength > 10) {
if(ptStart.y+nLength < nMaxSize) {
strPath.Format(_T("%s\\DebugFullImage\\%s\\%s\\%s\\%s\\%s__%s_%d"),PATH_INSPECTION_DATA,strDate,strRcpName,strGlassID,strTime,strGlassID,PANEL_SIDE[iSide],nFrame);
- m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength);
+ m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength);
+ g_pLog->DisplayMessage(_T("%s %d Save Completed : %s"), PANEL_SIDE[iSide], nFrame, strPath);
}
}
-
- g_pLog->DisplayMessage(_T("%s %d Save Completed : %s"),PANEL_SIDE[iSide],nFrame,strPath);
}
}
@@ -1367,7 +1349,7 @@
CCameraSettings* CViewMain_ScanImage::GetCameraSettingsByViewIndex(int nViewIndex)
{
CCameraSettings* pCamera = NULL;
- if (nullptr != m_pHardware) {
+ if (nullptr == m_pHardware) {
return pCamera;
}
diff --git a/EdgeInspector_App/stdafx.h b/EdgeInspector_App/stdafx.h
index f415982..db2d633 100644
--- a/EdgeInspector_App/stdafx.h
+++ b/EdgeInspector_App/stdafx.h
@@ -142,6 +142,14 @@
#pragma comment(lib, "SapClassBasic.lib")
#endif
+//7.绮惧害妫�妯″潡
+#include "../SDK/VisionMeasure/include/VisionMeasureClass.h"
+#if _DEBUG
+#pragma comment (lib, "../SDK/VisionMeasure/lib/Debug/VisionMeasure.lib")
+#else
+#pragma comment (lib, "../SDK/VisionMeasure/lib/Release/VisionMeasure.lib")
+#endif
+
// #pragma comment(linker, "/entry:WinMainCRTStartup /subsystem:console")
#ifdef _UNICODE
--
Gitblit v1.9.3