├── .gitattributes
├── .gitignore
├── AcquireDevice
├── AcquireDevice.cpp
├── AcquireDevice.h
├── AcquireDevice.rc
├── AcquireDevice.vcxproj
├── AcquireDevice.vcxproj.filters
├── AcquireDeviceDlg.cpp
├── AcquireDeviceDlg.h
├── CAcquireImage.cpp
├── CAcquireImage.h
├── Halcon_18_11_S_debug_x64.props
├── Halcon_18_11_S_release_x64.props
├── ImportHalconCpp.h
├── SaperaLT84_x64_debug.props
├── SaperaLT84_x64_release.props
├── framework.h
├── pch.cpp
├── pch.h
├── res
│ ├── AcquireDevice.ico
│ └── AcquireDevice.rc2
├── resource.h
├── system
│ ├── T_LA_CM_08K08A_00_R_External_Trigger_Board1.ccf
│ ├── T_LA_CM_08K08A_00_R_External_Trigger_Board1_ROI.ccf
│ ├── T_LA_CM_08K08A_00_R_External_Trigger_Board2.ccf
│ ├── T_LA_CM_08K08A_00_R_External_Trigger_Board3.ccf
│ ├── T_LA_CM_08K08A_00_R_External_Trigger_Board4.ccf
│ ├── T_LA_CM_08K08A_00_R_External_Trigger_Board4_ROI.ccf
│ ├── T_LA_CM_08K08A_00_R_FreeRun_1.ccf
│ ├── T_LA_CM_08K08A_00_R_FreeRun_1_ROI.ccf
│ ├── T_LA_CM_08K08A_00_R_FreeRun_2.ccf
│ ├── T_LA_CM_08K08A_00_R_FreeRun_3.ccf
│ ├── T_LA_CM_08K08A_00_R_FreeRun_4.ccf
│ └── T_LA_CM_08K08A_00_R_FreeRun_4_ROI.ccf
└── targetver.h
├── DeVision
├── BarChart.cpp
├── BarChart.h
├── CAcquireImage.cpp
├── CAcquireImage.h
├── CAlgorithmDlg.cpp
├── CAlgorithmDlg.h
├── CAnalysisDlg.cpp
├── CAnalysisDlg.h
├── CApplication.h
├── CAxes.h
├── CAxis.h
├── CBorder.h
├── CCameraDlg.cpp
├── CCameraDlg.h
├── CChart.h
├── CChartObject.h
├── CChartObjects.h
├── CCharts.h
├── CControl.cpp
├── CControl.h
├── CFont0.h
├── CGridlines.h
├── CHistoryDlg.cpp
├── CHistoryDlg.h
├── CImageProcessing.cpp
├── CImageProcessing.h
├── CInspectDlg.cpp
├── CInspectDlg.h
├── CLoad.cpp
├── CLoad.h
├── CLogin.cpp
├── CLogin.h
├── CMyDocument.cpp
├── CMyDocument.h
├── CMyView.cpp
├── CMyView.h
├── CPlotArea.h
├── CPoint0.h
├── CPoints.h
├── CProductInfo.cpp
├── CProductInfo.h
├── CRange.h
├── CRemote.cpp
├── CRemote.h
├── CSetupDlg.cpp
├── CSetupDlg.h
├── CShape.h
├── CShapeRange.h
├── CShapes.h
├── CTableDlg.cpp
├── CTableDlg.h
├── CWorkbook.h
├── CWorkbooks.h
├── CWorksheet.h
├── CWorksheets.h
├── DeVision.cpp
├── DeVision.h
├── DeVision.rc
├── DeVision.vcxproj
├── DeVision.vcxproj.filters
├── DeVisionDlg.cpp
├── DeVisionDlg.h
├── Halcon_18_11_S_debug_x64.props
├── Halcon_18_11_S_release_x64.props
├── ImportHalconCpp.h
├── Log.cpp
├── Log.h
├── PictureEx.cpp
├── PictureEx.h
├── SapClassGuiD.lib
├── SaperaLT84_x64_debug.props
├── SaperaLT84_x64_release.props
├── SerialPort.cpp
├── SerialPort.h
├── Text.cpp
├── Text.h
├── UBase.h
├── help
│ ├── 0.PNG
│ ├── 00.PNG
│ ├── 01.png
│ ├── 1.PNG
│ ├── 1.软件介绍.mht
│ ├── 10.PNG
│ ├── 11.PNG
│ ├── 12.PNG
│ ├── 13.PNG
│ ├── 14.PNG
│ ├── 15.PNG
│ ├── 16.PNG
│ ├── 2.PNG
│ ├── 2.登录.mht
│ ├── 3.PNG
│ ├── 3.菜单栏.mht
│ ├── 4.PNG
│ ├── 4.工具栏.mht
│ ├── 5.PNG
│ ├── 5.瑕疵显示.mht
│ ├── 6.PNG
│ ├── 6.页面切换.mht
│ ├── 7.PNG
│ ├── 7.状态栏.mht
│ ├── 8.PNG
│ ├── 9.PNG
│ ├── EasyCHM_Alias.h
│ ├── EasyCHM_Map.h
│ ├── UserGuide.CHM
│ ├── 主窗口.PNG
│ ├── 用户手册.docx
│ ├── 用户手册.mht
│ └── 首页.mht
├── iUart.cpp
├── iUart.h
├── inis
│ ├── ProductInformation.ini
│ └── SystemInfo.ini
├── log.rc
├── logResource.h
├── msado15.dll
├── res
│ ├── DeVision.rc2
│ ├── bitmap3.bmp
│ ├── camera_in.ico
│ ├── camera_out.ico
│ ├── change.ico
│ ├── changeX.ico
│ ├── exit.ico
│ ├── go_down.ico
│ ├── go_next.ico
│ ├── go_previous.ico
│ ├── go_up.ico
│ ├── icon2.ico
│ ├── load.bmp
│ ├── lock.ico
│ ├── loggin.ico
│ ├── login.ico
│ ├── logo128.ico
│ ├── logo32.ico
│ ├── logo64.ico
│ ├── offline.ico
│ ├── online.ico
│ ├── pause.ico
│ ├── process.gif
│ ├── start.ico
│ ├── start_ss.ico
│ ├── stop.ico
│ └── unlock.ico
├── resource.h
├── stdafx.cpp
├── stdafx.h
├── system
│ ├── ExampleModel.xlsx
│ ├── Model.svm
│ ├── T_LA_CM_08K08A_00_R_External.ccf
│ ├── T_LA_CM_08K08A_00_R_FreeRun.ccf
│ └── UserManageL.accdb
├── targetver.h
├── wcharUtil.cpp
└── wcharUtil.h
├── DeffectRegisitFile.reg
├── FindCamera
├── ExampleUtils.cpp
├── ExampleUtils.h
├── FindCamera.vcxproj
├── FindCamera.vcxproj.filters
├── SaperaLot_x64_release.props
└── main.cpp
├── HdevelopFiles
├── algorithm0606.hdev
├── algorithm_GPU_0606.hdev
├── gpu_test.hdev
├── special_change.hdev
├── stable_program_0228.hdev
├── stable_program_0303.hdev
├── stable_program_0320_multy_thread.hdev
├── stable_program_Cplusplus_0228.hdev
├── stable_program_Cplusplus_0303.hdev
├── stable_program_special.hdev
├── stable_program_special0320.hdev
├── 背景差分法20210226.hdev
└── 背景差分法_add_noise_20210301.hdev
├── MembranceDiscoverSystem.sln
├── ODBC
├── 1.PNG
├── 2.PNG
└── AccessDatabaseEngine_X64.exe
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/AcquireDevice/AcquireDevice.cpp:
--------------------------------------------------------------------------------
1 |
2 | // AcquireDevice.cpp: 定义应用程序的类行为。
3 | //
4 |
5 | #include "pch.h"
6 | #include "framework.h"
7 | #include "AcquireDevice.h"
8 | #include "AcquireDeviceDlg.h"
9 |
10 | #ifdef _DEBUG
11 | #define new DEBUG_NEW
12 | #endif
13 |
14 |
15 | // CAcquireDeviceApp
16 |
17 | BEGIN_MESSAGE_MAP(CAcquireDeviceApp, CWinApp)
18 | ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
19 | END_MESSAGE_MAP()
20 |
21 |
22 | // CAcquireDeviceApp 构造
23 |
24 | CAcquireDeviceApp::CAcquireDeviceApp()
25 | {
26 | // 支持重新启动管理器
27 | m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
28 |
29 | // TODO: 在此处添加构造代码,
30 | // 将所有重要的初始化放置在 InitInstance 中
31 | }
32 |
33 |
34 | // 唯一的 CAcquireDeviceApp 对象
35 |
36 | CAcquireDeviceApp theApp;
37 |
38 |
39 | // CAcquireDeviceApp 初始化
40 |
41 | BOOL CAcquireDeviceApp::InitInstance()
42 | {
43 | // 如果一个运行在 Windows XP 上的应用程序清单指定要
44 | // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
45 | //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
46 | INITCOMMONCONTROLSEX InitCtrls;
47 | InitCtrls.dwSize = sizeof(InitCtrls);
48 | // 将它设置为包括所有要在应用程序中使用的
49 | // 公共控件类。
50 | InitCtrls.dwICC = ICC_WIN95_CLASSES;
51 | InitCommonControlsEx(&InitCtrls);
52 |
53 | CWinApp::InitInstance();
54 |
55 |
56 | AfxEnableControlContainer();
57 |
58 | // 创建 shell 管理器,以防对话框包含
59 | // 任何 shell 树视图控件或 shell 列表视图控件。
60 | CShellManager *pShellManager = new CShellManager;
61 |
62 | // 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
63 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
64 |
65 | // 标准初始化
66 | // 如果未使用这些功能并希望减小
67 | // 最终可执行文件的大小,则应移除下列
68 | // 不需要的特定初始化例程
69 | // 更改用于存储设置的注册表项
70 | // TODO: 应适当修改该字符串,
71 | // 例如修改为公司或组织名
72 | SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
73 |
74 | CAcquireDeviceDlg dlg;
75 | m_pMainWnd = &dlg;
76 | INT_PTR nResponse = dlg.DoModal();
77 | if (nResponse == IDOK)
78 | {
79 | // TODO: 在此放置处理何时用
80 | // “确定”来关闭对话框的代码
81 | }
82 | else if (nResponse == IDCANCEL)
83 | {
84 | // TODO: 在此放置处理何时用
85 | // “取消”来关闭对话框的代码
86 | }
87 | else if (nResponse == -1)
88 | {
89 | TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
90 | TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
91 | }
92 |
93 | // 删除上面创建的 shell 管理器。
94 | if (pShellManager != nullptr)
95 | {
96 | delete pShellManager;
97 | }
98 |
99 | #if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
100 | ControlBarCleanUp();
101 | #endif
102 |
103 | // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
104 | // 而不是启动应用程序的消息泵。
105 | return FALSE;
106 | }
107 |
108 |
--------------------------------------------------------------------------------
/AcquireDevice/AcquireDevice.h:
--------------------------------------------------------------------------------
1 |
2 | // AcquireDevice.h: PROJECT_NAME 应用程序的主头文件
3 | //
4 |
5 | #pragma once
6 |
7 | #ifndef __AFXWIN_H__
8 | #error "include 'pch.h' before including this file for PCH"
9 | #endif
10 |
11 | #include "resource.h" // 主符号
12 |
13 |
14 | // CAcquireDeviceApp:
15 | // 有关此类的实现,请参阅 AcquireDevice.cpp
16 | //
17 |
18 | class CAcquireDeviceApp : public CWinApp
19 | {
20 | public:
21 | CAcquireDeviceApp();
22 |
23 | // 重写
24 | public:
25 | virtual BOOL InitInstance();
26 |
27 | // 实现
28 |
29 | DECLARE_MESSAGE_MAP()
30 | };
31 |
32 | extern CAcquireDeviceApp theApp;
33 |
--------------------------------------------------------------------------------
/AcquireDevice/AcquireDevice.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/AcquireDevice/AcquireDevice.rc
--------------------------------------------------------------------------------
/AcquireDevice/AcquireDevice.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 头文件
20 |
21 |
22 | 头文件
23 |
24 |
25 | 头文件
26 |
27 |
28 | 头文件
29 |
30 |
31 | 头文件
32 |
33 |
34 | 头文件
35 |
36 |
37 | 头文件
38 |
39 |
40 | 头文件
41 |
42 |
43 |
44 |
45 | 源文件
46 |
47 |
48 | 源文件
49 |
50 |
51 | 源文件
52 |
53 |
54 | 源文件
55 |
56 |
57 |
58 |
59 | 资源文件
60 |
61 |
62 |
63 |
64 | 资源文件
65 |
66 |
67 |
68 |
69 | 资源文件
70 |
71 |
72 |
--------------------------------------------------------------------------------
/AcquireDevice/AcquireDeviceDlg.cpp:
--------------------------------------------------------------------------------
1 |
2 | // AcquireDeviceDlg.cpp: 实现文件
3 | //
4 |
5 | #include "pch.h"
6 | #include "framework.h"
7 | #include "AcquireDevice.h"
8 | #include "AcquireDeviceDlg.h"
9 | #include "afxdialogex.h"
10 |
11 | #ifdef _DEBUG
12 | #define new DEBUG_NEW
13 | #endif
14 |
15 |
16 | // CAcquireDeviceDlg 对话框
17 |
18 |
19 |
20 | CAcquireDeviceDlg::CAcquireDeviceDlg(CWnd* pParent /*=nullptr*/)
21 | : CDialogEx(IDD_ACQUIREDEVICE_DIALOG, pParent)
22 | {
23 | m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
24 | }
25 |
26 | void CAcquireDeviceDlg::DoDataExchange(CDataExchange* pDX)
27 | {
28 | CDialogEx::DoDataExchange(pDX);
29 |
30 | }
31 |
32 | BEGIN_MESSAGE_MAP(CAcquireDeviceDlg, CDialogEx)
33 | ON_WM_PAINT()
34 | ON_WM_QUERYDRAGICON()
35 | ON_BN_CLICKED(IDC_BTN_OPEN, &CAcquireDeviceDlg::OnBnClickedBtnOpen)
36 | ON_BN_CLICKED(IDC_BTN_CLOSE, &CAcquireDeviceDlg::OnBnClickedBtnClose)
37 | ON_BN_CLICKED(IDC_BTN_ACQ, &CAcquireDeviceDlg::OnBnClickedBtnAcq)
38 | ON_BN_CLICKED(IDC_BTN_STOP, &CAcquireDeviceDlg::OnBnClickedBtnStop)
39 | END_MESSAGE_MAP()
40 |
41 |
42 | // CAcquireDeviceDlg 消息处理程序
43 |
44 | BOOL CAcquireDeviceDlg::OnInitDialog()
45 | {
46 | CDialogEx::OnInitDialog();
47 |
48 | // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
49 | // 执行此操作
50 | SetIcon(m_hIcon, TRUE); // 设置大图标
51 | SetIcon(m_hIcon, FALSE); // 设置小图标
52 |
53 | // TODO: 在此添加额外的初始化代码
54 | HWND hwnd = GetDlgItem(IDC_IMAGE1)->GetSafeHwnd();
55 | m_acquires.m_hwnd[0] = hwnd;
56 | hwnd = GetDlgItem(IDC_IMAGE2)->GetSafeHwnd();
57 | m_acquires.m_hwnd[1] = hwnd;
58 | hwnd = GetDlgItem(IDC_IMAGE3)->GetSafeHwnd();
59 | m_acquires.m_hwnd[2] = hwnd;
60 | hwnd = GetDlgItem(IDC_IMAGE4)->GetSafeHwnd();
61 | m_acquires.m_hwnd[3] = hwnd;
62 |
63 |
64 |
65 | return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
66 | }
67 |
68 | // 如果向对话框添加最小化按钮,则需要下面的代码
69 | // 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
70 | // 这将由框架自动完成。
71 |
72 | void CAcquireDeviceDlg::OnPaint()
73 | {
74 | if (IsIconic())
75 | {
76 | CPaintDC dc(this); // 用于绘制的设备上下文
77 |
78 | SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0);
79 |
80 | // 使图标在工作区矩形中居中
81 | int cxIcon = GetSystemMetrics(SM_CXICON);
82 | int cyIcon = GetSystemMetrics(SM_CYICON);
83 | CRect rect;
84 | GetClientRect(&rect);
85 | int x = (rect.Width() - cxIcon + 1) / 2;
86 | int y = (rect.Height() - cyIcon + 1) / 2;
87 |
88 | // 绘制图标
89 | dc.DrawIcon(x, y, m_hIcon);
90 | }
91 | else
92 | {
93 | CDialogEx::OnPaint();
94 | }
95 | }
96 |
97 | //当用户拖动最小化窗口时系统调用此函数取得光标
98 | //显示。
99 | HCURSOR CAcquireDeviceDlg::OnQueryDragIcon()
100 | {
101 | return static_cast(m_hIcon);
102 | }
103 |
104 |
105 |
106 | void CAcquireDeviceDlg::OnBnClickedBtnOpen()
107 | {
108 | // TODO: 在此添加控件通知处理程序代码
109 | m_acquires.CameraSystemInitial();
110 |
111 |
112 | }
113 |
114 |
115 | void CAcquireDeviceDlg::OnBnClickedBtnClose()
116 | {
117 | // TODO: 在此添加控件通知处理程序代码
118 | }
119 |
120 |
121 | void CAcquireDeviceDlg::OnBnClickedBtnAcq()
122 | {
123 | // TODO: 在此添加控件通知处理程序代码
124 | m_acquires.Grab();
125 | }
126 |
127 |
128 | void CAcquireDeviceDlg::OnBnClickedBtnStop()
129 | {
130 | // TODO: 在此添加控件通知处理程序代码
131 | m_acquires.Freeze();
132 | }
133 |
--------------------------------------------------------------------------------
/AcquireDevice/AcquireDeviceDlg.h:
--------------------------------------------------------------------------------
1 |
2 | // AcquireDeviceDlg.h: 头文件
3 | //
4 |
5 | #pragma once
6 |
7 | #include "CAcquireImage.h"
8 |
9 | // CAcquireDeviceDlg 对话框
10 | class CAcquireDeviceDlg : public CDialogEx
11 | {
12 | // 构造
13 | public:
14 | CAcquireDeviceDlg(CWnd* pParent = nullptr); // 标准构造函数
15 |
16 | // 对话框数据
17 | #ifdef AFX_DESIGN_TIME
18 | enum { IDD = IDD_ACQUIREDEVICE_DIALOG };
19 | #endif
20 |
21 | protected:
22 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
23 |
24 | public:
25 |
26 | private:
27 | CAcquireImage m_acquires;
28 |
29 |
30 | // 实现
31 | protected:
32 | HICON m_hIcon;
33 |
34 | // 生成的消息映射函数
35 | virtual BOOL OnInitDialog();
36 | afx_msg void OnPaint();
37 | afx_msg HCURSOR OnQueryDragIcon();
38 | DECLARE_MESSAGE_MAP()
39 | public:
40 | afx_msg void OnBnClickedBtnOpen();
41 | afx_msg void OnBnClickedBtnClose();
42 | afx_msg void OnBnClickedBtnAcq();
43 | afx_msg void OnBnClickedBtnStop();
44 | };
45 |
--------------------------------------------------------------------------------
/AcquireDevice/CAcquireImage.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/AcquireDevice/CAcquireImage.cpp
--------------------------------------------------------------------------------
/AcquireDevice/CAcquireImage.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/AcquireDevice/CAcquireImage.h
--------------------------------------------------------------------------------
/AcquireDevice/Halcon_18_11_S_debug_x64.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | C:\Program Files\MVTec\HALCON-18.11-Progress\include\halconcpp;C:\Program Files\MVTec\HALCON-18.11-Progress\include;$(IncludePath)
7 | C:\Program Files\MVTec\HALCON-18.11-Progress\lib\x64-win64;$(LibraryPath)
8 |
9 |
10 |
11 | C:\Program Files\MVTec\HALCON-18.11-Progress\lib\x64-win64;%(AdditionalLibraryDirectories)
12 | halconcpp.lib;%(AdditionalDependencies)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AcquireDevice/Halcon_18_11_S_release_x64.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | C:\Program Files\MVTec\HALCON-18.11-Progress\include\halconcpp;C:\Program Files\MVTec\HALCON-18.11-Progress\include;$(IncludePath)
7 | C:\Program Files\MVTec\HALCON-18.11-Progress\lib\x64-win64;$(LibraryPath)
8 |
9 |
10 |
11 | halconcpp.lib;%(AdditionalDependencies)
12 | C:\Program Files\MVTec\HALCON-18.11-Progress\lib\x64-win64;%(AdditionalLibraryDirectories)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AcquireDevice/ImportHalconCpp.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "HalconCpp.h"
4 | #include "HDevThread.h"
5 |
6 | using namespace HalconCpp;
7 |
8 | namespace HDevExportCpp
9 | {
10 | // Parallel execution wrapper for write_image(...)
11 | static void* _hcppthread_write_image(void *hcthread);
12 | }
13 |
14 | // Generated stubs for parallel procedure calls. Wrapped in name
15 | // space to avoid name conflicts with actual procedure names
16 | namespace HDevExportCpp
17 | {
18 | // Parallel execution wrapper for write_image(...)
19 | static void* _hcppthread_write_image(void *hcthread)
20 | {
21 | // +++ define thread context for this procedure
22 | HDevThread* hcppthread = (HDevThread*)hcthread;
23 | try
24 | {
25 | // Input parameters
26 | const HObject &cbho_Image = hcppthread->GetInputIconicParamObject(0);
27 | const HTuple &cbhv_Format = hcppthread->GetInputCtrlParamTuple(1);
28 | const HTuple &cbhv_FillColor = hcppthread->GetInputCtrlParamTuple(2);
29 | const HTuple &cbhv_FileName = hcppthread->GetInputCtrlParamTuple(3);
30 |
31 | // Call write_image
32 | WriteImage(cbho_Image, cbhv_Format, cbhv_FillColor, cbhv_FileName);
33 |
34 | // Reduce reference counter of thread object
35 | hcppthread->Exit();
36 | delete hcppthread;
37 |
38 | }
39 | catch (HException& exc)
40 | {
41 | // No exceptions may be raised from stub in parallel case,
42 | // so we need to store this information prior to cleanup
43 | bool is_direct_call = hcppthread->IsDirectCall();
44 | // Attempt to clean up in error case, too
45 | hcppthread->Exit();
46 | delete hcppthread;
47 | // Propagate exception if called directly
48 | if (is_direct_call)
49 | throw exc;
50 | }
51 | return NULL;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/AcquireDevice/SaperaLT84_x64_debug.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | C:\Program Files\Teledyne DALSA\Sapera\Classes\Gui;C:\Program Files\Teledyne DALSA\Sapera\Classes\Basic;C:\Program Files\Teledyne DALSA\Sapera\Include;%(AdditionalIncludeDirectories)
9 |
10 |
11 | C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64;C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64\VS2017;%(AdditionalLibraryDirectories)
12 | SapClassBasic.lib;corapi.lib;%(AdditionalDependencies)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AcquireDevice/SaperaLT84_x64_release.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | SapClassBasic.lib;corapi.lib;%(AdditionalDependencies)
9 | C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64;%(AdditionalLibraryDirectories)
10 |
11 |
12 | C:\Program Files\Teledyne DALSA\Sapera\Classes\Basic;C:\Program Files\Teledyne DALSA\Sapera\Classes\Gui;C:\Program Files\Teledyne DALSA\Sapera\Include;%(AdditionalIncludeDirectories)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AcquireDevice/framework.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifndef VC_EXTRALEAN
4 | #define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
5 | #endif
6 |
7 | #include "targetver.h"
8 |
9 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
10 |
11 | // 关闭 MFC 的一些常见且经常可放心忽略的隐藏警告消息
12 | #define _AFX_ALL_WARNINGS
13 |
14 | #include // MFC 核心组件和标准组件
15 | #include // MFC 扩展
16 |
17 |
18 | #include // MFC 自动化类
19 |
20 |
21 |
22 | #ifndef _AFX_NO_OLE_SUPPORT
23 | #include // MFC 对 Internet Explorer 4 公共控件的支持
24 | #endif
25 | #ifndef _AFX_NO_AFXCMN_SUPPORT
26 | #include // MFC 对 Windows 公共控件的支持
27 | #endif // _AFX_NO_AFXCMN_SUPPORT
28 |
29 | #include // MFC 支持功能区和控制条
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | #ifdef _UNICODE
40 | #if defined _M_IX86
41 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
42 | #elif defined _M_X64
43 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
44 | #else
45 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
46 | #endif
47 | #endif
48 |
49 |
50 |
--------------------------------------------------------------------------------
/AcquireDevice/pch.cpp:
--------------------------------------------------------------------------------
1 | // pch.cpp: 与预编译标头对应的源文件
2 |
3 | #include "pch.h"
4 |
5 | // 当使用预编译的头时,需要使用此源文件,编译才能成功。
6 |
--------------------------------------------------------------------------------
/AcquireDevice/pch.h:
--------------------------------------------------------------------------------
1 | // pch.h: 这是预编译标头文件。
2 | // 下方列出的文件仅编译一次,提高了将来生成的生成性能。
3 | // 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
4 | // 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
5 | // 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
6 |
7 | #ifndef PCH_H
8 | #define PCH_H
9 |
10 | // 添加要在此处预编译的标头
11 | #include "framework.h"
12 |
13 | #endif //PCH_H
14 |
--------------------------------------------------------------------------------
/AcquireDevice/res/AcquireDevice.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/AcquireDevice/res/AcquireDevice.ico
--------------------------------------------------------------------------------
/AcquireDevice/res/AcquireDevice.rc2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/AcquireDevice/res/AcquireDevice.rc2
--------------------------------------------------------------------------------
/AcquireDevice/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ 生成的包含文件。
3 | // 供 AcquireDevice.rc 使用
4 | //
5 | #define IDD_ACQUIREDEVICE_DIALOG 102
6 | #define IDR_MAINFRAME 128
7 | #define IDC_IMAGE 1000
8 | #define IDC_IMAGE1 1000
9 | #define IDC_BTN_OPEN 1001
10 | #define IDC_BTN_CLOSE 1002
11 | #define IDC_LIST_LOG 1003
12 | #define IDC_EDIT1 1004
13 | #define IDC_BUTTON3 1005
14 | #define IDC_BTN_ACQ 1006
15 | #define IDC_BTN_STOP 1007
16 | #define IDC_IMAGE2 1008
17 | #define IDC_IMAGE3 1009
18 | #define IDC_IMAGE4 1010
19 |
20 | // Next default values for new objects
21 | //
22 | #ifdef APSTUDIO_INVOKED
23 | #ifndef APSTUDIO_READONLY_SYMBOLS
24 | #define _APS_NEXT_RESOURCE_VALUE 130
25 | #define _APS_NEXT_COMMAND_VALUE 32771
26 | #define _APS_NEXT_CONTROL_VALUE 1011
27 | #define _APS_NEXT_SYMED_VALUE 101
28 | #endif
29 | #endif
30 |
--------------------------------------------------------------------------------
/AcquireDevice/system/T_LA_CM_08K08A_00_R_External_Trigger_Board1.ccf:
--------------------------------------------------------------------------------
1 | [Board]
2 | Server Name=Xtium-CL_MX4
3 | Device Name=CameraLink Full Mono
4 | Device Index=0
5 | [General]
6 | Version=301
7 | Vic Name=Board4_CC1_AB
8 | Time Stamp Base=1
9 | Camera Name=External_Trigger
10 | Company Name=Teledyne DALSA
11 | Model Name=LA_CM_08K08A_00_R
12 | [Input]
13 | Bit Ordering=1
14 | Camera Selector=0
15 | Planar Input Sources=0
16 | [Signal Conditioning]
17 | Bayer Decoder Enable=0
18 | Bayer Decoder Method=0
19 | Bayer Decoder White Balance Gain Red=0
20 | Bayer Decoder White Balance Gain Green=0
21 | Bayer Decoder White Balance Gain Blue=0
22 | Bayer Decoder Saturation Factor=0
23 | Bayer Decoder Saturation Weight Red=0
24 | Bayer Decoder Saturation Weight Green=0
25 | Bayer Decoder Saturation Weight Blue=0
26 | Bayer Decoder White Balance Offset Red=0
27 | Bayer Decoder White Balance Offset Green=0
28 | Bayer Decoder White Balance Offset Blue=0
29 | Brightness=0
30 | Brightness Blue=0
31 | Brightness Green=0
32 | Brightness Red=0
33 | Contrast=100000
34 | Contrast Blue=100000
35 | Contrast Green=100000
36 | Contrast Red=100000
37 | DC Restoration Mode=1
38 | DC Restoration Start=0
39 | DC Restoration Width=0
40 | Fix Filter Enable=0
41 | Fix Filter Selector=0
42 | Hue=0
43 | Programmable Filter Enable=0
44 | Programmable Filter Frequency=5500000
45 | Saturation=100000
46 | Sharpness=0
47 | [Stream Conditioning]
48 | Crop Activation=0
49 | Crop Height=8192
50 | Crop Left=0
51 | Crop Top=0
52 | Crop Width=8192
53 | Decimate Count=0
54 | Decimate Method=1
55 | External Trigger Frame Count=1
56 | Flip=0
57 | Frame Length=1
58 | Horizontal Sync Reference=2
59 | Lut Enable=0
60 | Lut Number=0
61 | Pixel Mask=255
62 | Scale Horizontal=8192
63 | Scale Horizontal Method=1
64 | Scale Vertical=8192
65 | Scale Vertical Method=1
66 | Snap Count=1
67 | Vertical Sync Reference=2
68 | [Control Signals]
69 | Camera Control Pulse 0 HD Align=0
70 | Camera Control Pulse 1 HD Align=0
71 | Camera Frames Per Trigger=1
72 | Camera Reset Delay=0
73 | Camera Reset Enable=0
74 | Camera Trigger Delay=0
75 | Camera Trigger Enable=0
76 | Line Integrate Time Base=256
77 | Board Sync Output 1 Source=0
78 | Board Sync Output 2 Source=0
79 | External Frame Trigger Detection=8
80 | External Frame Trigger Enable=0
81 | External Frame Trigger Level=8
82 | External Frame Trigger Source=0
83 | External Line Trigger Detection=4
84 | External Line Trigger Enable=0
85 | External Line Trigger Level=2
86 | External Line Trigger Source=1
87 | External Trigger Detection=4
88 | External Trigger Delay=0
89 | External Trigger Delay Time Base=128
90 | External Trigger Duration=0
91 | External Trigger Enable=1
92 | External Trigger Ignore Delay=0
93 | External Trigger Ignore Region Duration=0
94 | External Trigger Level=8
95 | External Trigger Source=0
96 | Frame Integrate Count=1
97 | Frame Integrate Enable=0
98 | Internal Frame Trigger Enable=0
99 | Internal Frame Trigger Freq=30000
100 | Internal Line Trigger Enable=0
101 | Internal Line Trigger Freq=5000
102 | Line Integrate Duration=1
103 | Line Integrate Enable=0
104 | Line Trigger Enable=1
105 | Line Trigger Auto Delay=0
106 | LineScan Direction Output=1
107 | Master Mode=0
108 | Master Mode Horizontal Sync Polarity=1
109 | Master Mode Vertical Sync Polarity=1
110 | PoCL Enable=0
111 | Shaft Encoder Enable=1
112 | Shaft Encoder Pulse Drop=0
113 | Shaft Encoder Level=2
114 | Shaft Encoder Pulse Multiply=1
115 | Shaft Encoder Source=0
116 | Shaft Encoder Direction=0
117 | Shaft Encoder Order=0
118 | Strobe Delay=0
119 | Strobe Delay 2=0
120 | Strobe Duration=1
121 | Strobe Enable=0
122 | Strobe Level=1
123 | Strobe Method=0
124 | Strobe Polarity=1
125 | Time Integrate Duration=1
126 | Time Integrate Enable=0
127 | Time Integrate Delay=0
128 | Vertical Timeout Delay=0
129 | WEN Enable=0
130 | Camera Control During Readout=0
131 | Camera Line Trigger Frequency Minimum=1
132 | Camera Line Trigger Frequency Maximum=16777215
133 | Camera Reset Duration=1
134 | Camera Reset Method=0
135 | Camera Reset Polarity=1
136 | Camera Time Integrate Duration Minimum=1
137 | Camera Time Integrate Duration Maximum=85899345
138 | Camera Trigger Duration=1
139 | Camera Trigger Method=0
140 | Camera Trigger Polarity=1
141 | Data Valid Enable=0
142 | Data Valid Polarity=2
143 | Frame Integrate Method=0
144 | Frame Integrate Polarity=1
145 | Line Integrate Method=0
146 | Line Integrate Pulse 0 Delay=0
147 | Line Integrate Pulse 0 Duration=1
148 | Line Integrate Pulse 0 Polarity=1
149 | Line Integrate Pulse 1 Delay=0
150 | Line Integrate Pulse 1 Duration=1
151 | Line Integrate Pulse 1 Polarity=1
152 | Line Trigger Delay=0
153 | Line Trigger Duration=1
154 | Line Trigger Method=1
155 | Line Trigger Polarity=1
156 | LineScan Direction=0
157 | LineScan Direction Polarity=2
158 | Time Integrate Method=0
159 | Time Integrate Pulse 0 Delay=0
160 | Time Integrate Pulse 0 Duration=1
161 | Time Integrate Pulse 0 Polarity=1
162 | Time Integrate Pulse 1 Delay=0
163 | Time Integrate Pulse 1 Duration=1
164 | Time Integrate Pulse 1 Polarity=1
165 | WEN Polarity=0
166 | [Output]
167 | Output Format=1
168 | [Shared Control Signals]
169 | Camera Reset=-1
170 | Camera Trigger=-1
171 | External Trigger=-1
172 | Frame Integrate=-1
173 | Strobe=-1
174 | Time Integrate=-1
175 | [Signal Description]
176 | Bayer Alignment=0
177 | Bit Transfer Rate=0
178 | Channel=1
179 | Channels Order=1
180 | Coupling=0
181 | Field Order=4
182 | Frame=2
183 | Interface=2
184 | Data Lanes=0
185 | Pixel Depth=8
186 | Scan=2
187 | Signal=2
188 | Tap Output=4
189 | Tap 1 Direction=21
190 | Tap 2 Direction=21
191 | Tap 3 Direction=21
192 | Tap 4 Direction=21
193 | Tap 5 Direction=21
194 | Tap 6 Direction=21
195 | Tap 7 Direction=21
196 | Tap 8 Direction=21
197 | Tap 9 Direction=21
198 | Tap 10 Direction=21
199 | Tap 11 Direction=21
200 | Tap 12 Direction=21
201 | Tap 13 Direction=21
202 | Tap 14 Direction=21
203 | Tap 15 Direction=21
204 | Tap 16 Direction=21
205 | Taps=8
206 | Video=1
207 | Video Standard=1
208 | Video Level Minimum=0
209 | Video Level Maximum=0
210 | [Signal Timings]
211 | Horizontal Active=1024
212 | Horizontal Back Invalid=0
213 | Horizontal Back Porch=0
214 | Horizontal Front Invalid=0
215 | Horizontal Front Porch=0
216 | Horizontal Sync=8
217 | Vertical Active=480
218 | Vertical Back Invalid=0
219 | Vertical Back Porch=0
220 | Vertical Front Invalid=0
221 | Vertical Front Porch=0
222 | Vertical Sync=1
223 | [Pixel Clock]
224 | Pixel Clock Frequency 1:1=20000000
225 | Pixel Clock Detection=4
226 | Pixel Clock Frequency External=20000000
227 | Pixel Clock Frequency Internal=20000000
228 | Pixel Clock Source=2
229 | [Synchronization Signals]
230 | Horizontal Sync Polarity=1
231 | Synchronization Source=4
232 | Vertical Sync Polarity=1
233 | [Connector Description]
234 | Camera Link Configuration=0x4
235 | CX4 Configuration=0x0
236 | CLHS Configuration=0x0
237 | Timeslot=0x1
238 | Exposure Input=0x0
239 | HD Input=0x0
240 | Line Integrate Input=0x1020001
241 | Line Trigger Input=0x0
242 | Linescan Direction Input=0x0
243 | Pixel Clock Output=0x0
244 | Reset/Trigger Input=0x0
245 | VD Input=0x0
246 | WEN Output=0x0
247 | [Custom Camera IO Control Signals]
248 | Max Control=0
249 | [Serial Port]
250 | Baud Rate=0x40
251 | Data Bits=0x10
252 | Flow Control=0x1
253 | Parity=0x1
254 | Stop Bits=0x1
255 | Initialization String=
256 |
--------------------------------------------------------------------------------
/AcquireDevice/system/T_LA_CM_08K08A_00_R_External_Trigger_Board2.ccf:
--------------------------------------------------------------------------------
1 | [Board]
2 | Server Name=Xtium-CL_MX4
3 | Device Name=CameraLink Full Mono
4 | Device Index=0
5 | [General]
6 | Version=301
7 | Vic Name=Board4_CC1_AB
8 | Time Stamp Base=1
9 | Camera Name=External_Trigger
10 | Company Name=Teledyne DALSA
11 | Model Name=LA_CM_08K08A_00_R
12 | [Input]
13 | Bit Ordering=1
14 | Camera Selector=0
15 | Planar Input Sources=0
16 | [Signal Conditioning]
17 | Bayer Decoder Enable=0
18 | Bayer Decoder Method=0
19 | Bayer Decoder White Balance Gain Red=0
20 | Bayer Decoder White Balance Gain Green=0
21 | Bayer Decoder White Balance Gain Blue=0
22 | Bayer Decoder Saturation Factor=0
23 | Bayer Decoder Saturation Weight Red=0
24 | Bayer Decoder Saturation Weight Green=0
25 | Bayer Decoder Saturation Weight Blue=0
26 | Bayer Decoder White Balance Offset Red=0
27 | Bayer Decoder White Balance Offset Green=0
28 | Bayer Decoder White Balance Offset Blue=0
29 | Brightness=0
30 | Brightness Blue=0
31 | Brightness Green=0
32 | Brightness Red=0
33 | Contrast=100000
34 | Contrast Blue=100000
35 | Contrast Green=100000
36 | Contrast Red=100000
37 | DC Restoration Mode=1
38 | DC Restoration Start=0
39 | DC Restoration Width=0
40 | Fix Filter Enable=0
41 | Fix Filter Selector=0
42 | Hue=0
43 | Programmable Filter Enable=0
44 | Programmable Filter Frequency=5500000
45 | Saturation=100000
46 | Sharpness=0
47 | [Stream Conditioning]
48 | Crop Activation=0
49 | Crop Height=8192
50 | Crop Left=0
51 | Crop Top=0
52 | Crop Width=8192
53 | Decimate Count=0
54 | Decimate Method=1
55 | External Trigger Frame Count=1
56 | Flip=0
57 | Frame Length=1
58 | Horizontal Sync Reference=2
59 | Lut Enable=0
60 | Lut Number=0
61 | Pixel Mask=255
62 | Scale Horizontal=8192
63 | Scale Horizontal Method=1
64 | Scale Vertical=8192
65 | Scale Vertical Method=1
66 | Snap Count=1
67 | Vertical Sync Reference=2
68 | [Control Signals]
69 | Camera Control Pulse 0 HD Align=0
70 | Camera Control Pulse 1 HD Align=0
71 | Camera Frames Per Trigger=1
72 | Camera Reset Delay=0
73 | Camera Reset Enable=0
74 | Camera Trigger Delay=0
75 | Camera Trigger Enable=0
76 | Line Integrate Time Base=256
77 | Board Sync Output 1 Source=0
78 | Board Sync Output 2 Source=0
79 | External Frame Trigger Detection=8
80 | External Frame Trigger Enable=0
81 | External Frame Trigger Level=8
82 | External Frame Trigger Source=0
83 | External Line Trigger Detection=4
84 | External Line Trigger Enable=0
85 | External Line Trigger Level=2
86 | External Line Trigger Source=1
87 | External Trigger Detection=4
88 | External Trigger Delay=0
89 | External Trigger Delay Time Base=128
90 | External Trigger Duration=0
91 | External Trigger Enable=1
92 | External Trigger Ignore Delay=0
93 | External Trigger Ignore Region Duration=0
94 | External Trigger Level=8
95 | External Trigger Source=0
96 | Frame Integrate Count=1
97 | Frame Integrate Enable=0
98 | Internal Frame Trigger Enable=0
99 | Internal Frame Trigger Freq=30000
100 | Internal Line Trigger Enable=0
101 | Internal Line Trigger Freq=5000
102 | Line Integrate Duration=1
103 | Line Integrate Enable=0
104 | Line Trigger Enable=1
105 | Line Trigger Auto Delay=0
106 | LineScan Direction Output=1
107 | Master Mode=0
108 | Master Mode Horizontal Sync Polarity=1
109 | Master Mode Vertical Sync Polarity=1
110 | PoCL Enable=0
111 | Shaft Encoder Enable=1
112 | Shaft Encoder Pulse Drop=0
113 | Shaft Encoder Level=2
114 | Shaft Encoder Pulse Multiply=1
115 | Shaft Encoder Source=0
116 | Shaft Encoder Direction=0
117 | Shaft Encoder Order=0
118 | Strobe Delay=0
119 | Strobe Delay 2=0
120 | Strobe Duration=1
121 | Strobe Enable=0
122 | Strobe Level=1
123 | Strobe Method=0
124 | Strobe Polarity=1
125 | Time Integrate Duration=1
126 | Time Integrate Enable=0
127 | Time Integrate Delay=0
128 | Vertical Timeout Delay=0
129 | WEN Enable=0
130 | Camera Control During Readout=0
131 | Camera Line Trigger Frequency Minimum=1
132 | Camera Line Trigger Frequency Maximum=16777215
133 | Camera Reset Duration=1
134 | Camera Reset Method=0
135 | Camera Reset Polarity=1
136 | Camera Time Integrate Duration Minimum=1
137 | Camera Time Integrate Duration Maximum=85899345
138 | Camera Trigger Duration=1
139 | Camera Trigger Method=0
140 | Camera Trigger Polarity=1
141 | Data Valid Enable=0
142 | Data Valid Polarity=2
143 | Frame Integrate Method=0
144 | Frame Integrate Polarity=1
145 | Line Integrate Method=0
146 | Line Integrate Pulse 0 Delay=0
147 | Line Integrate Pulse 0 Duration=1
148 | Line Integrate Pulse 0 Polarity=1
149 | Line Integrate Pulse 1 Delay=0
150 | Line Integrate Pulse 1 Duration=1
151 | Line Integrate Pulse 1 Polarity=1
152 | Line Trigger Delay=0
153 | Line Trigger Duration=1
154 | Line Trigger Method=1
155 | Line Trigger Polarity=1
156 | LineScan Direction=0
157 | LineScan Direction Polarity=2
158 | Time Integrate Method=0
159 | Time Integrate Pulse 0 Delay=0
160 | Time Integrate Pulse 0 Duration=1
161 | Time Integrate Pulse 0 Polarity=1
162 | Time Integrate Pulse 1 Delay=0
163 | Time Integrate Pulse 1 Duration=1
164 | Time Integrate Pulse 1 Polarity=1
165 | WEN Polarity=0
166 | [Output]
167 | Output Format=1
168 | [Shared Control Signals]
169 | Camera Reset=-1
170 | Camera Trigger=-1
171 | External Trigger=-1
172 | Frame Integrate=-1
173 | Strobe=-1
174 | Time Integrate=-1
175 | [Signal Description]
176 | Bayer Alignment=0
177 | Bit Transfer Rate=0
178 | Channel=1
179 | Channels Order=1
180 | Coupling=0
181 | Field Order=4
182 | Frame=2
183 | Interface=2
184 | Data Lanes=0
185 | Pixel Depth=8
186 | Scan=2
187 | Signal=2
188 | Tap Output=4
189 | Tap 1 Direction=21
190 | Tap 2 Direction=21
191 | Tap 3 Direction=21
192 | Tap 4 Direction=21
193 | Tap 5 Direction=21
194 | Tap 6 Direction=21
195 | Tap 7 Direction=21
196 | Tap 8 Direction=21
197 | Tap 9 Direction=21
198 | Tap 10 Direction=21
199 | Tap 11 Direction=21
200 | Tap 12 Direction=21
201 | Tap 13 Direction=21
202 | Tap 14 Direction=21
203 | Tap 15 Direction=21
204 | Tap 16 Direction=21
205 | Taps=8
206 | Video=1
207 | Video Standard=1
208 | Video Level Minimum=0
209 | Video Level Maximum=0
210 | [Signal Timings]
211 | Horizontal Active=1024
212 | Horizontal Back Invalid=0
213 | Horizontal Back Porch=0
214 | Horizontal Front Invalid=0
215 | Horizontal Front Porch=0
216 | Horizontal Sync=8
217 | Vertical Active=480
218 | Vertical Back Invalid=0
219 | Vertical Back Porch=0
220 | Vertical Front Invalid=0
221 | Vertical Front Porch=0
222 | Vertical Sync=1
223 | [Pixel Clock]
224 | Pixel Clock Frequency 1:1=20000000
225 | Pixel Clock Detection=4
226 | Pixel Clock Frequency External=20000000
227 | Pixel Clock Frequency Internal=20000000
228 | Pixel Clock Source=2
229 | [Synchronization Signals]
230 | Horizontal Sync Polarity=1
231 | Synchronization Source=4
232 | Vertical Sync Polarity=1
233 | [Connector Description]
234 | Camera Link Configuration=0x4
235 | CX4 Configuration=0x0
236 | CLHS Configuration=0x0
237 | Timeslot=0x1
238 | Exposure Input=0x0
239 | HD Input=0x0
240 | Line Integrate Input=0x1020001
241 | Line Trigger Input=0x0
242 | Linescan Direction Input=0x0
243 | Pixel Clock Output=0x0
244 | Reset/Trigger Input=0x0
245 | VD Input=0x0
246 | WEN Output=0x0
247 | [Custom Camera IO Control Signals]
248 | Max Control=0
249 | [Serial Port]
250 | Baud Rate=0x40
251 | Data Bits=0x10
252 | Flow Control=0x1
253 | Parity=0x1
254 | Stop Bits=0x1
255 | Initialization String=
256 |
--------------------------------------------------------------------------------
/AcquireDevice/system/T_LA_CM_08K08A_00_R_FreeRun_3.ccf:
--------------------------------------------------------------------------------
1 | [Board]
2 | Server Name=Xtium-CL_MX4
3 | Device Name=CameraLink Full Mono
4 | Device Index=0
5 | [General]
6 | Version=301
7 | Vic Name=Default Area Scan 1 tap Mono
8 | Time Stamp Base=1
9 | Camera Name=FreeRun
10 | Company Name=Teledyne DALSA
11 | Model Name=LA_CM_08K08A_00_R
12 | [Input]
13 | Bit Ordering=1
14 | Camera Selector=0
15 | Planar Input Sources=0
16 | [Signal Conditioning]
17 | Bayer Decoder Enable=0
18 | Bayer Decoder Method=0
19 | Bayer Decoder White Balance Gain Red=0
20 | Bayer Decoder White Balance Gain Green=0
21 | Bayer Decoder White Balance Gain Blue=0
22 | Bayer Decoder Saturation Factor=0
23 | Bayer Decoder Saturation Weight Red=0
24 | Bayer Decoder Saturation Weight Green=0
25 | Bayer Decoder Saturation Weight Blue=0
26 | Bayer Decoder White Balance Offset Red=0
27 | Bayer Decoder White Balance Offset Green=0
28 | Bayer Decoder White Balance Offset Blue=0
29 | Brightness=0
30 | Brightness Blue=0
31 | Brightness Green=0
32 | Brightness Red=0
33 | Contrast=100000
34 | Contrast Blue=100000
35 | Contrast Green=100000
36 | Contrast Red=100000
37 | DC Restoration Mode=1
38 | DC Restoration Start=0
39 | DC Restoration Width=0
40 | Fix Filter Enable=0
41 | Fix Filter Selector=0
42 | Hue=0
43 | Programmable Filter Enable=0
44 | Programmable Filter Frequency=5500000
45 | Saturation=100000
46 | Sharpness=0
47 | [Stream Conditioning]
48 | Crop Activation=0
49 | Crop Height=8192
50 | Crop Left=0
51 | Crop Top=0
52 | Crop Width=8192
53 | Decimate Count=0
54 | Decimate Method=1
55 | External Trigger Frame Count=1
56 | Flip=0
57 | Frame Length=1
58 | Horizontal Sync Reference=2
59 | Lut Enable=0
60 | Lut Number=0
61 | Pixel Mask=255
62 | Scale Horizontal=8192
63 | Scale Horizontal Method=1
64 | Scale Vertical=8192
65 | Scale Vertical Method=1
66 | Snap Count=1
67 | Vertical Sync Reference=2
68 | [Control Signals]
69 | Camera Control Pulse 0 HD Align=0
70 | Camera Control Pulse 1 HD Align=0
71 | Camera Frames Per Trigger=1
72 | Camera Reset Delay=0
73 | Camera Reset Enable=0
74 | Camera Trigger Delay=0
75 | Camera Trigger Enable=0
76 | Line Integrate Time Base=256
77 | Board Sync Output 1 Source=0
78 | Board Sync Output 2 Source=0
79 | External Frame Trigger Detection=8
80 | External Frame Trigger Enable=0
81 | External Frame Trigger Level=8
82 | External Frame Trigger Source=0
83 | External Line Trigger Detection=4
84 | External Line Trigger Enable=0
85 | External Line Trigger Level=2
86 | External Line Trigger Source=0
87 | External Trigger Detection=4
88 | External Trigger Delay=0
89 | External Trigger Delay Time Base=128
90 | External Trigger Duration=0
91 | External Trigger Enable=1
92 | External Trigger Ignore Delay=0
93 | External Trigger Ignore Region Duration=0
94 | External Trigger Level=8
95 | External Trigger Source=0
96 | Frame Integrate Count=1
97 | Frame Integrate Enable=0
98 | Internal Frame Trigger Enable=0
99 | Internal Frame Trigger Freq=30000
100 | Internal Line Trigger Enable=0
101 | Internal Line Trigger Freq=5000
102 | Line Integrate Duration=1
103 | Line Integrate Enable=0
104 | Line Trigger Enable=0
105 | Line Trigger Auto Delay=0
106 | LineScan Direction Output=1
107 | Master Mode=0
108 | Master Mode Horizontal Sync Polarity=1
109 | Master Mode Vertical Sync Polarity=1
110 | PoCL Enable=0
111 | Shaft Encoder Enable=0
112 | Shaft Encoder Pulse Drop=0
113 | Shaft Encoder Level=2
114 | Shaft Encoder Pulse Multiply=1
115 | Shaft Encoder Source=0
116 | Shaft Encoder Direction=0
117 | Shaft Encoder Order=0
118 | Strobe Delay=0
119 | Strobe Delay 2=0
120 | Strobe Duration=1
121 | Strobe Enable=0
122 | Strobe Level=1
123 | Strobe Method=0
124 | Strobe Polarity=1
125 | Time Integrate Duration=1
126 | Time Integrate Enable=0
127 | Time Integrate Delay=0
128 | Vertical Timeout Delay=0
129 | WEN Enable=0
130 | Camera Control During Readout=0
131 | Camera Line Trigger Frequency Minimum=1
132 | Camera Line Trigger Frequency Maximum=16777215
133 | Camera Reset Duration=1
134 | Camera Reset Method=0
135 | Camera Reset Polarity=1
136 | Camera Time Integrate Duration Minimum=1
137 | Camera Time Integrate Duration Maximum=85899345
138 | Camera Trigger Duration=1
139 | Camera Trigger Method=0
140 | Camera Trigger Polarity=1
141 | Data Valid Enable=0
142 | Data Valid Polarity=2
143 | Frame Integrate Method=0
144 | Frame Integrate Polarity=1
145 | Line Integrate Method=0
146 | Line Integrate Pulse 0 Delay=0
147 | Line Integrate Pulse 0 Duration=1
148 | Line Integrate Pulse 0 Polarity=1
149 | Line Integrate Pulse 1 Delay=0
150 | Line Integrate Pulse 1 Duration=1
151 | Line Integrate Pulse 1 Polarity=1
152 | Line Trigger Delay=0
153 | Line Trigger Duration=1
154 | Line Trigger Method=0
155 | Line Trigger Polarity=1
156 | LineScan Direction=0
157 | LineScan Direction Polarity=2
158 | Time Integrate Method=0
159 | Time Integrate Pulse 0 Delay=0
160 | Time Integrate Pulse 0 Duration=1
161 | Time Integrate Pulse 0 Polarity=1
162 | Time Integrate Pulse 1 Delay=0
163 | Time Integrate Pulse 1 Duration=1
164 | Time Integrate Pulse 1 Polarity=1
165 | WEN Polarity=0
166 | [Output]
167 | Output Format=1
168 | [Shared Control Signals]
169 | Camera Reset=-1
170 | Camera Trigger=-1
171 | External Trigger=-1
172 | Frame Integrate=-1
173 | Strobe=-1
174 | Time Integrate=-1
175 | [Signal Description]
176 | Bayer Alignment=0
177 | Bit Transfer Rate=0
178 | Channel=1
179 | Channels Order=1
180 | Coupling=0
181 | Field Order=4
182 | Frame=2
183 | Interface=2
184 | Data Lanes=0
185 | Pixel Depth=8
186 | Scan=2
187 | Signal=2
188 | Tap Output=4
189 | Tap 1 Direction=21
190 | Tap 2 Direction=21
191 | Tap 3 Direction=21
192 | Tap 4 Direction=21
193 | Tap 5 Direction=21
194 | Tap 6 Direction=21
195 | Tap 7 Direction=21
196 | Tap 8 Direction=21
197 | Tap 9 Direction=21
198 | Tap 10 Direction=21
199 | Tap 11 Direction=21
200 | Tap 12 Direction=21
201 | Tap 13 Direction=21
202 | Tap 14 Direction=21
203 | Tap 15 Direction=21
204 | Tap 16 Direction=21
205 | Taps=8
206 | Video=1
207 | Video Standard=1
208 | Video Level Minimum=0
209 | Video Level Maximum=0
210 | [Signal Timings]
211 | Horizontal Active=1024
212 | Horizontal Back Invalid=0
213 | Horizontal Back Porch=0
214 | Horizontal Front Invalid=0
215 | Horizontal Front Porch=0
216 | Horizontal Sync=8
217 | Vertical Active=480
218 | Vertical Back Invalid=0
219 | Vertical Back Porch=0
220 | Vertical Front Invalid=0
221 | Vertical Front Porch=0
222 | Vertical Sync=1
223 | [Pixel Clock]
224 | Pixel Clock Frequency 1:1=20000000
225 | Pixel Clock Detection=4
226 | Pixel Clock Frequency External=20000000
227 | Pixel Clock Frequency Internal=20000000
228 | Pixel Clock Source=2
229 | [Synchronization Signals]
230 | Horizontal Sync Polarity=1
231 | Synchronization Source=4
232 | Vertical Sync Polarity=1
233 | [Connector Description]
234 | Camera Link Configuration=0x4
235 | CX4 Configuration=0x0
236 | CLHS Configuration=0x0
237 | Timeslot=0x1
238 | Exposure Input=0x0
239 | HD Input=0x0
240 | Line Integrate Input=0x0
241 | Line Trigger Input=0x0
242 | Linescan Direction Input=0x0
243 | Pixel Clock Output=0x0
244 | Reset/Trigger Input=0x0
245 | VD Input=0x0
246 | WEN Output=0x0
247 | [Custom Camera IO Control Signals]
248 | Max Control=0
249 | [Serial Port]
250 | Baud Rate=0x40
251 | Data Bits=0x10
252 | Flow Control=0x1
253 | Parity=0x1
254 | Stop Bits=0x1
255 | Initialization String=
256 |
--------------------------------------------------------------------------------
/AcquireDevice/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
4 |
5 | // 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
6 | // 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/DeVision/CAcquireImage.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CAcquireImage.cpp
--------------------------------------------------------------------------------
/DeVision/CAcquireImage.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CAcquireImage.h
--------------------------------------------------------------------------------
/DeVision/CAlgorithmDlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | // CAlgorithmDlg 对话框
6 |
7 | class CAlgorithmDlg : public CDialogEx
8 | {
9 | DECLARE_DYNAMIC(CAlgorithmDlg)
10 |
11 | public:
12 | CAlgorithmDlg(CWnd* pParent = nullptr); // 标准构造函数
13 | virtual ~CAlgorithmDlg();
14 |
15 | // 对话框数据
16 | #ifdef AFX_DESIGN_TIME
17 | enum { IDD = IDD_DIALOG_ALGORITHM };
18 | #endif
19 |
20 | public:
21 | HWND hMainWnd; //主窗口句柄
22 |
23 | BOOL m_bSave_Parameter = FALSE; //是否保存
24 | int m_normal_distribution = 0;
25 | int m_filter_size = 0;
26 | float m_min_radius = 0.0f;
27 | float m_max_radius = 0.0f;
28 |
29 | int m_nRankMethod;
30 | float m_fRankValue1;
31 | float m_fRankValue2;
32 | float m_fRankValue3;
33 |
34 | LPCWSTR APPNAME = L"Algorithm";
35 | LPCWSTR FILEPATH = L"inis\\SystemInfo.ini";
36 |
37 |
38 | private:
39 | void loadInitialParameters();
40 | void saveParameters();
41 |
42 | float GetSelectAreaValueMin();
43 | float GetSelectAreaValueMax();
44 |
45 | protected:
46 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
47 |
48 | DECLARE_MESSAGE_MAP()
49 |
50 | public:
51 | virtual BOOL OnInitDialog();
52 | afx_msg void OnDestroy();
53 | virtual void OnOK();
54 | virtual void OnCancel();
55 | CComboBox m_combo_global_threshold;
56 | CComboBox m_combo_select_threshold;
57 | afx_msg void OnClose();
58 | afx_msg void OnBnClickedButtonReset();
59 | afx_msg void OnBnClickedRadioArea();
60 | afx_msg void OnBnClickedRadioRadius();
61 | afx_msg void OnBnClickedRadioContlength();
62 | afx_msg void OnEnKillfocusEditAreaValue1();
63 | afx_msg void OnEnKillfocusEditAreaValue2();
64 | afx_msg void OnEnKillfocusEditAreaValue3();
65 | afx_msg void OnEnKillfocusEditRadiusValue1();
66 | afx_msg void OnEnKillfocusEditRadiusValue2();
67 | afx_msg void OnEnKillfocusEditRadiusValue3();
68 | afx_msg void OnEnKillfocusEditContValue1();
69 | afx_msg void OnEnKillfocusEditContValue2();
70 | afx_msg void OnEnKillfocusEditContValue3();
71 | };
72 |
--------------------------------------------------------------------------------
/DeVision/CAnalysisDlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "BarChart.h"
4 |
5 |
6 | // CAnalysisDlg 对话框
7 |
8 | class CAnalysisDlg : public CDialogEx
9 | {
10 | DECLARE_DYNAMIC(CAnalysisDlg)
11 |
12 | public:
13 | CAnalysisDlg(CWnd* pParent = nullptr); // 标准构造函数
14 | virtual ~CAnalysisDlg();
15 |
16 | // 对话框数据
17 | #ifdef AFX_DESIGN_TIME
18 | enum { IDD = IDD_DIALOG_ANALYSIS };
19 | #endif
20 |
21 | protected:
22 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
23 |
24 | DECLARE_MESSAGE_MAP()
25 |
26 | public:
27 | HWND hMainWnd; //主窗口句柄
28 | std::string m_strSavePath;
29 |
30 | enum { IDD = IDD_DIALOG_ANALYSIS };
31 | BOOL m_bShowGrid;
32 | BOOL m_bShowText;
33 | BOOL m_bShowLable;
34 | BOOL m_bShowTip;
35 | BOOL m_bShowPercent;
36 | double m_dDftNumber1;
37 | double m_dDftNumber2;
38 | double m_dDftNumber3;
39 | double m_dDftNumber4;
40 |
41 | void UpdateChartValue();
42 |
43 | protected:
44 |
45 | HICON m_hIcon;
46 | CBarChart m_chart;
47 | CBrush m_brushBK;
48 |
49 | void CreateCustomBarChart();
50 |
51 |
52 | private:
53 |
54 | CWinThread *m_pUpdateThread;
55 | bool m_bThreadAlive;
56 | static UINT userUpdateBarChart(LPVOID pParam);
57 |
58 |
59 | //COpenGLControl m_oglWindow;
60 | HBITMAP GetSrcBit(HDC hDC, LPRECT rEct);
61 | bool SaveBitmapToFile(HBITMAP hBitmap, const char* name);
62 |
63 | virtual BOOL OnInitDialog();
64 | afx_msg void OnBnClickedButtonReset();
65 | afx_msg void OnSize(UINT nType, int cx, int cy);
66 | afx_msg void OnBnClickedCheckGrid();
67 | afx_msg void OnBnClickedCheckText();
68 | afx_msg void OnBnClickedCheckLabel();
69 | afx_msg void OnBnClickedCheckTooltips();
70 | afx_msg void OnBnClickedCheckPercent();
71 | public:
72 | afx_msg void OnBnClickedButtonAnalysisSave();
73 | afx_msg void OnPaint();
74 | afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
75 | afx_msg void OnDestroy();
76 | };
77 |
--------------------------------------------------------------------------------
/DeVision/CApplication.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CApplication.h
--------------------------------------------------------------------------------
/DeVision/CAxes.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CAxes.h
--------------------------------------------------------------------------------
/DeVision/CAxis.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CAxis.h
--------------------------------------------------------------------------------
/DeVision/CBorder.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CBorder.h
--------------------------------------------------------------------------------
/DeVision/CCameraDlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 |
4 | // CCameraDlg 对话框
5 | #include "SerialPort.h"
6 | #include "iUart.h"
7 | #include "Text.h"
8 | #include "SapClassBasic.h"
9 | #include "SapClassGui.h"
10 | #include "CInspectDlg.h"
11 |
12 | class CCameraDlg : public CDialogEx, public CImageExWndEventHandler
13 | {
14 | DECLARE_DYNAMIC(CCameraDlg)
15 |
16 | public:
17 | CCameraDlg(CWnd* pParent = nullptr); // 标准构造函数
18 | virtual ~CCameraDlg();
19 |
20 | public:
21 | HWND hMainWnd; //主窗口句柄
22 |
23 | //串口类
24 | bool isOpened = false;
25 | iUart mUart;
26 | void WriteRegData(void);
27 | void GetRegData(CString &comName, CString &dcbConfig);
28 | void LoadRegConfig();
29 | bool OpenUart();
30 | bool IsUartPortAvailable(void);
31 | DCB GetUartConfigDCB(void);
32 | HANDLE hRxThread; // receive thread HANDLE
33 | TextBank DataRx, DataTx;
34 | void OnChangeEditTxData(CStringA strtmp);
35 | int AsyncSend(const CStringA& dataStr) {
36 | return mUart.UnblockSend(dataStr);
37 | }
38 | int AsyncRead(CString& dataStr) {
39 | return mUart.UnblockRead(dataStr);
40 | }
41 | void InitialUartPort();
42 |
43 | //相机
44 | public:
45 |
46 | double exposure_time;
47 | int select_camera_number = 0;
48 | private:
49 | //CImageExWnd m_ImageWnd1;
50 | //CImageExWnd m_ImageWnd2;
51 | //CImageExWnd m_ImageWnd3;
52 | //CImageExWnd m_ImageWnd4;
53 |
54 | CInspectDlg *pInspectDlg;
55 |
56 | BOOL m_Image_Wnd_Initialized;
57 |
58 | UINT_PTR mTimer;
59 | BOOL InitializeCWndAndView();
60 | void UpdateCameraParameter();
61 | void GetFrameRate(SapTransfer *m_Xfer);
62 | void GetBufferSize(SapBuffer * m_buffer);
63 | void GetCameraParameter(SapAcqDevice* m_AcqDevice);
64 |
65 | // 对话框数据
66 | #ifdef AFX_DESIGN_TIME
67 | enum { IDD = IDD_DIALOG_CAMERA };
68 | #endif
69 |
70 | protected:
71 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
72 |
73 | DECLARE_MESSAGE_MAP()
74 | public:
75 |
76 | virtual BOOL OnInitDialog();
77 | //afx_msg void OnTimer(UINT_PTR nIDEvent);
78 | afx_msg void OnBnClickedButtonOpenuart();
79 | afx_msg void OnBnClickedButtonCloseuart();
80 | afx_msg void OnBnClickedButton3();
81 | afx_msg void OnBnClickedButton4();
82 | afx_msg void OnNMCustomdrawSlider1(NMHDR *pNMHDR, LRESULT *pResult);
83 | CButton m_camera1_selected;
84 | CButton m_camera2_selected;
85 | CButton m_camera3_selected;
86 | CButton m_camera4_selected;
87 | afx_msg void OnSize(UINT nType, int cx, int cy);
88 | afx_msg void OnDestroy();
89 | afx_msg void OnEndSession(BOOL bEnding);
90 | afx_msg void OnTimer(UINT_PTR nIDEvent);
91 | CStatic m_camera_name;
92 | CStatic m_camera_temperature;
93 | CEdit m_exposure_time;
94 | afx_msg void OnBnClickedButtonSetExposure();
95 | CStatic m_current_frame;
96 | CStatic m_total_frame;
97 | CStatic m_exposuretime_display;
98 | CStatic m_buffer_size;
99 | };
100 |
--------------------------------------------------------------------------------
/DeVision/CChart.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CChart.h
--------------------------------------------------------------------------------
/DeVision/CChartObject.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CChartObject.h
--------------------------------------------------------------------------------
/DeVision/CChartObjects.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CChartObjects.h
--------------------------------------------------------------------------------
/DeVision/CCharts.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CCharts.h
--------------------------------------------------------------------------------
/DeVision/CControl.cpp:
--------------------------------------------------------------------------------
1 | // CControl.cpp: 实现文件
2 | //
3 |
4 | #include "stdafx.h"
5 | #include "DeVision.h"
6 | #include "CControl.h"
7 |
8 |
9 | // CControl
10 |
11 | IMPLEMENT_DYNAMIC(CControl, CWnd)
12 |
13 | CControl::CControl()
14 | {
15 |
16 | }
17 |
18 | CControl::~CControl()
19 | {
20 | }
21 |
22 |
23 | BEGIN_MESSAGE_MAP(CControl, CWnd)
24 | END_MESSAGE_MAP()
25 |
26 |
27 |
28 | // CControl 消息处理程序
29 |
30 |
31 |
--------------------------------------------------------------------------------
/DeVision/CControl.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 |
4 | // CControl
5 |
6 | class CControl : public CWnd
7 | {
8 | DECLARE_DYNAMIC(CControl)
9 |
10 | public:
11 | CControl();
12 | virtual ~CControl();
13 |
14 | protected:
15 | DECLARE_MESSAGE_MAP()
16 |
17 | public:
18 |
19 |
20 | };
21 |
22 |
23 |
--------------------------------------------------------------------------------
/DeVision/CFont0.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CFont0.h
--------------------------------------------------------------------------------
/DeVision/CGridlines.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CGridlines.h
--------------------------------------------------------------------------------
/DeVision/CHistoryDlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | // CHistoryDlg 对话框
6 |
7 | class CHistoryDlg : public CDialogEx
8 | {
9 | DECLARE_DYNAMIC(CHistoryDlg)
10 |
11 | public:
12 | CHistoryDlg(CWnd* pParent = nullptr); // 标准构造函数
13 | virtual ~CHistoryDlg();
14 |
15 | // 对话框数据
16 | #ifdef AFX_DESIGN_TIME
17 | enum { IDD = IDD_DIALOG_HISTORY };
18 | #endif
19 |
20 | protected:
21 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
22 |
23 | DECLARE_MESSAGE_MAP()
24 |
25 | public:
26 | HWND hMainWnd; //主窗口句柄
27 |
28 | //std::string m_strPath; //历史图像路径
29 |
30 | //std::vector m_vImages;
31 | BOOL LoadHistoryImage();
32 |
33 | int m_pages;
34 | std::string m_file_path = "D:\\DetectRecords\\HistoryImages";
35 |
36 | protected:
37 | CWnd *pwnd1;
38 | CWnd *pwnd2;
39 | CWnd *pwnd3;
40 | CWnd *pwnd4;
41 | CWnd *pwnd5;
42 | CWnd *pwnd6;
43 | CWnd *pwnd7;
44 | CWnd *pwnd8;
45 | CWnd *pwnd9;
46 |
47 | private:
48 | std::vector m_vImage_name;
49 | bool m_bPagging;
50 |
51 | CWinThread *m_pRefrushThread;
52 | bool m_bThreadAlive;
53 | static UINT autoRefrush(LPVOID pParam);
54 |
55 |
56 | void RefrushImgWnd(std::string path, std::vector vstring);
57 | void RefrushHistoryWnd(int page_index);
58 | void ReadDFTInfo(std::string name, std::string &kind, std::string &position, std::string &radius, std::string &area);
59 | void ShowBitmap(CWnd *pWnd, CString BmpName);
60 | void ShowBitmap(CWnd *pWnd, const char* BmpName);
61 |
62 |
63 | public:
64 | afx_msg void OnBnClickedButtonPrePage();
65 | afx_msg void OnBnClickedButtonNextPage();
66 | CStatic m_img1;
67 | CStatic m_img2;
68 | CStatic m_img3;
69 | CStatic m_img4;
70 | CStatic m_img5;
71 | CStatic m_img6;
72 | CStatic m_img7;
73 | CStatic m_img8;
74 | CStatic m_img9;
75 | virtual BOOL OnInitDialog();
76 | afx_msg void OnDestroy();
77 | CButton m_btn_pre_page;
78 | CButton m_btn_next_page;
79 | afx_msg void OnPaint();
80 | afx_msg void OnBnClickedButtonOpenhistorypath();
81 | afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
82 | afx_msg void OnTimer(UINT_PTR nIDEvent);
83 | };
84 |
--------------------------------------------------------------------------------
/DeVision/CImageProcessing.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CImageProcessing.cpp
--------------------------------------------------------------------------------
/DeVision/CImageProcessing.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CImageProcessing.h
--------------------------------------------------------------------------------
/DeVision/CInspectDlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | //#include "CImageProcess.h"
6 | #include "CProductInfo.h"
7 | #include "SapClassBasic.h"
8 | #include "SapClassGui.h"
9 |
10 | // CInspectDlg 对话框
11 |
12 | class CInspectDlg : public CDialogEx, public CImageExWndEventHandler, public SapManager
13 | {
14 | DECLARE_DYNAMIC(CInspectDlg)
15 |
16 | public:
17 | CInspectDlg(CWnd* pParent = nullptr); // 标准构造函数
18 |
19 | virtual ~CInspectDlg();
20 |
21 | // 对话框数据
22 | #ifdef AFX_DESIGN_TIME
23 | enum { IDD = IDD_DIALOG_INSPECT };
24 | #endif
25 |
26 | public:
27 | HWND hMainWnd; //主窗口句柄
28 |
29 | bool m_bSystemRunning;
30 | CImageExWnd m_ImageWnd[4];
31 | bool m_bTableSaving; // 切卷:报表保存中
32 | CFont m_font;
33 | BOOL m_bDeffectDisplay[4];
34 | COLORREF m_color1;
35 | COLORREF m_color2;
36 | COLORREF m_color3;
37 | COLORREF m_color4;
38 |
39 | CString m_cstrBatch; // 保存的为下一卷的卷号,需要从control item获取当前卷号
40 | int m_nBatchIndex;
41 | CString m_cstrName;
42 | CString m_cstrSchedule;
43 | CString m_cstrAddition;
44 |
45 | void RecordWarning(const std::wstring& str); //记录报警信息
46 | void RecordWarning(int test, CString cstr);
47 | void RecordLogList(const std::wstring& str); //记录日志
48 | void RecordLogList(int test, CString cstr);
49 | void UpdateDFTinformation(size_t total_num, int great_dft_num, int num1, int num2, int num3, int num4);
50 | void ResetBatchInformation();
51 | void SetBatchInfoControlItem();
52 |
53 | private:
54 | HICON m_hChangeIcon;
55 | HICON m_hChangeXIcon;
56 |
57 | CString GetTimeStamp();
58 |
59 | protected:
60 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
61 | virtual BOOL OnInitDialog();
62 | DECLARE_MESSAGE_MAP()
63 | public:
64 | CButton m_btnSwitchRoll; // 切卷
65 | CListBox m_listLog;
66 | CListBox m_listWarning;
67 | CEdit m_eBatch;
68 | CEdit m_eName;
69 | CEdit m_eSchedule;
70 | CEdit m_eAddition;
71 | afx_msg void OnDestroy();
72 | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
73 | afx_msg void OnSize(UINT nType, int cx, int cy);
74 | afx_msg void OnTimer(UINT_PTR nIDEvent);
75 | afx_msg void OnBnClickedButtonInfoChange();
76 | afx_msg void OnBnClickedMfccolorbutton1();
77 | afx_msg void OnBnClickedMfccolorbutton2();
78 | afx_msg void OnBnClickedMfccolorbutton3();
79 | afx_msg void OnBnClickedMfccolorbutton4();
80 | afx_msg void OnBnClickedCheck1();
81 | afx_msg void OnBnClickedCheck2();
82 | afx_msg void OnBnClickedCheck3();
83 | afx_msg void OnBnClickedCheck4();
84 | };
85 |
--------------------------------------------------------------------------------
/DeVision/CLoad.cpp:
--------------------------------------------------------------------------------
1 | // CLoad.cpp: 实现文件
2 | //
3 | //启动界面加载位图
4 |
5 | #include "stdafx.h"
6 | #include "DeVision.h"
7 | #include "CLoad.h"
8 |
9 |
10 | // CLoad
11 |
12 | IMPLEMENT_DYNAMIC(CLoad, CWnd)
13 |
14 | CLoad::CLoad()
15 | {
16 |
17 | }
18 |
19 | CLoad::~CLoad()
20 | {
21 | }
22 |
23 |
24 | BEGIN_MESSAGE_MAP(CLoad, CWnd)
25 | ON_WM_PAINT()
26 | ON_WM_DESTROY()
27 | ON_WM_CLOSE()
28 | END_MESSAGE_MAP()
29 |
30 |
31 |
32 | // CLoad 消息处理程序
33 |
34 |
35 | BOOL CLoad::Create()
36 | {
37 | m_bitmap.LoadBitmapW(IDB_BITMAP_LOADDING);
38 | BITMAP bitmap;
39 | m_bitmap.GetBitmap(&bitmap);
40 | int x = (::GetSystemMetrics(SM_CXSCREEN) - bitmap.bmWidth) / 3;
41 | int y = (::GetSystemMetrics(SM_CXSCREEN) - bitmap.bmHeight) / 3;
42 | CRect rect(x, y, x + bitmap.bmWidth, y + bitmap.bmHeight);
43 | CreateEx(0, AfxRegisterWndClass(0), L"", WS_POPUP | WS_VISIBLE | WS_BORDER, rect, NULL, 0);
44 |
45 | return Create();
46 | }
47 |
48 | BOOL CLoad::Create(UINT nBitmapID)
49 | {
50 | // TODO: 在此添加专用代码和/或调用基类
51 | m_bitmap.LoadBitmapW(nBitmapID);
52 | BITMAP bitmap;
53 | m_bitmap.GetBitmap(&bitmap);
54 | int x = (::GetSystemMetrics(SM_CXSCREEN) - bitmap.bmWidth) / 2;
55 | int y = (::GetSystemMetrics(SM_CYSCREEN) - bitmap.bmHeight) / 2;
56 | CRect rect(x, y, x + bitmap.bmWidth, y + bitmap.bmHeight);
57 | CreateEx(0, AfxRegisterWndClass(0), L"", WS_POPUP | WS_VISIBLE | WS_BORDER, rect, NULL, 0);
58 |
59 | return TRUE;
60 | }
61 |
62 |
63 | //BOOL CLoad::CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, LPVOID lpParam)
64 | //{
65 | // // TODO: 在此添加专用代码和/或调用基类
66 | // // TODO: 在此添加专用代码和/或调用基类
67 | //
68 | // return CWnd::CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, lpParam);
69 | //}
70 |
71 |
72 | void CLoad::OnPaint()
73 | {
74 | CPaintDC dc(this); // device context for painting
75 | // TODO: 在此处添加消息处理程序代码
76 | // 不为绘图消息调用 CWnd::OnPaint()
77 | BITMAP bitmap;
78 | m_bitmap.GetBitmap(&bitmap);
79 | CDC dcComp;
80 | dcComp.CreateCompatibleDC(&dc);
81 | dcComp.SelectObject(&m_bitmap);
82 | dc.BitBlt(0, 0, bitmap.bmWidth, bitmap.bmHeight, &dcComp, 0, 0, SRCCOPY);
83 |
84 | }
85 |
86 |
87 | void CLoad::OnDestroy()
88 | {
89 | CWnd::OnDestroy();
90 |
91 | // TODO: 在此处添加消息处理程序代码
92 | }
93 |
94 |
95 | void CLoad::OnClose()
96 | {
97 | // TODO: 在此添加消息处理程序代码和/或调用默认值
98 | CWnd::OnClose();
99 | }
100 |
101 |
--------------------------------------------------------------------------------
/DeVision/CLoad.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 |
4 | // CLoad
5 |
6 | class CLoad : public CWnd
7 | {
8 | DECLARE_DYNAMIC(CLoad)
9 |
10 | public:
11 | CLoad();
12 | virtual ~CLoad();
13 |
14 | protected:
15 | DECLARE_MESSAGE_MAP()
16 | public:
17 |
18 | CBitmap m_bitmap;
19 |
20 | virtual BOOL Create(void);
21 | virtual BOOL Create(UINT nBitmapID);
22 | // virtual BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, LPVOID lpParam = NULL);
23 | afx_msg void OnPaint();
24 | afx_msg void OnDestroy();
25 | afx_msg void OnClose();
26 | };
27 |
28 |
29 |
--------------------------------------------------------------------------------
/DeVision/CLogin.cpp:
--------------------------------------------------------------------------------
1 | // CLogin.cpp: 实现文件
2 | //
3 |
4 | #include "stdafx.h"
5 | #include "DeVision.h"
6 | #include "CLogin.h"
7 | #include "afxdialogex.h"
8 |
9 | #include
10 |
11 | // CLogin 对话框
12 |
13 | IMPLEMENT_DYNAMIC(CLogin, CDialogEx)
14 |
15 | CLogin::CLogin(CWnd* pParent /*=nullptr*/)
16 | : CDialogEx(IDD_DIALOG_LOGIN, pParent)
17 | {
18 | ACCEPTED = FALSE;
19 | }
20 |
21 | CLogin::~CLogin()
22 | {
23 | }
24 |
25 | void CLogin::DoDataExchange(CDataExchange* pDX)
26 | {
27 | CDialogEx::DoDataExchange(pDX);
28 | DDX_Control(pDX, IDC_EDIT_USERNAME, m_edit_name);
29 | DDX_Control(pDX, IDC_EDIT_PASSWORD, m_edit_password);
30 | }
31 |
32 |
33 | BEGIN_MESSAGE_MAP(CLogin, CDialogEx)
34 | ON_BN_CLICKED(IDOK, &CLogin::OnBnClickedOk)
35 | ON_BN_CLICKED(IDCANCEL, &CLogin::OnBnClickedCancel)
36 | ON_WM_DESTROY()
37 | END_MESSAGE_MAP()
38 |
39 |
40 | BOOL CLogin::OnInitDialog()
41 | {
42 | CDialogEx::OnInitDialog();
43 |
44 | //TODO: 在此添加额外的初始化
45 |
46 | //首先确认安装的office是否是64位版本,之后安装AccessDatabaseEngine_english_X64.exe,第三步在odbc 64中建立 系统dsn
47 | try {
48 | //连接数据库
49 | ::CoInitialize(NULL);
50 | HRESULT hr = m_pConnection.CreateInstance(_uuidof(Connection));
51 | if (SUCCEEDED(hr)) {
52 | _bstr_t strConnect = "Provider=Microsoft.ACE.OLEDB.12.0;\
53 | Data Source=.\\system\\UserManageL.accdb;\
54 | Persist Security Info=False;\
55 | Jet OLEDB:Database Password='qazwsxedc'";
56 | m_pConnection->Open(strConnect, "", "", adModeUnknown);
57 |
58 | m_pCommand.CreateInstance(_uuidof(Command));
59 | m_pCommand->CommandTimeout = 5;
60 | m_pCommand->ActiveConnection = m_pConnection;
61 | }
62 | }catch (_com_error e){
63 | CString errormessage;
64 | errormessage.Format(L"连接数据库失败!\r\n错误信息:%s", e.ErrorMessage());
65 | AfxMessageBox(errormessage, MB_ICONERROR);//显示错误信息
66 | if (m_pConnection->State)
67 | m_pConnection->Close();
68 | return FALSE;
69 | }
70 |
71 |
72 | return TRUE; // return TRUE unless you set the focus to a control
73 | // 异常: OCX 属性页应返回 FALSE
74 | }
75 |
76 | void CLogin::OnDestroy()
77 | {
78 | CDialogEx::OnDestroy();
79 |
80 | // TODO: 在此处添加消息处理程序代码
81 |
82 | //如果数据库连接有效, 则关闭数据库连接
83 | if (m_pConnection != NULL) {
84 | if (m_pConnection->State)
85 | m_pConnection->Close();
86 | m_pConnection = NULL;
87 | }
88 |
89 | }
90 |
91 | // CLogin 消息处理程序
92 |
93 | //登录
94 | void CLogin::OnBnClickedOk()
95 | {
96 | // TODO: 在此添加控件通知处理程序代码
97 | this->UpdateData(true);
98 | CString cname, cpassword;
99 | m_edit_name.GetWindowTextW(cname);
100 | m_strname = CW2A(cname);
101 | m_edit_password.GetWindowTextW(cpassword);
102 | m_strpassword = CW2A(cpassword);
103 |
104 |
105 | m_pRecordset.CreateInstance(_uuidof(Recordset));
106 | //m_pRecordset.CreateInstance("ADODB.Recordset");
107 | try {
108 | m_pRecordset->Open("SELECT * FROM UserTab",
109 | _variant_t((IDispatch*)m_pConnection,true),
110 | adOpenDynamic,
111 | adLockOptimistic,
112 | adCmdText);
113 |
114 | //处理数据
115 | _variant_t varID, varname, varpassword;
116 | CString access_ID, access_name, access_password;
117 | long index = 0;//注意:必须是long类型
118 | int countItem = 0;
119 | while (!m_pRecordset->adoEOF)
120 | {
121 | index = 0;
122 | //读ID号
123 | varID = m_pRecordset->GetCollect(_variant_t(index));
124 | if (varID.vt != VT_NULL){
125 | access_ID.Format(L"%d", varID.lVal);
126 | }
127 | //读ID后面的字段的数据
128 | varname = m_pRecordset->GetCollect(_variant_t(index + 1));
129 | if (varname.vt != VT_NULL) {
130 | access_name = (LPCTSTR)(_bstr_t)varname;
131 | varpassword = m_pRecordset->GetCollect(_variant_t(index + 2));
132 | if (varpassword.vt != VT_NULL) {
133 | access_password = (LPCTSTR)(_bstr_t)varpassword;
134 | if (cname == access_name && cpassword == access_password) {
135 | ACCEPTED = TRUE;
136 | m_logo_name = cname;
137 | break;
138 | }
139 | }
140 | }
141 | m_pRecordset->MoveNext();
142 | countItem++;
143 | }
144 | m_pRecordset->Close();
145 | }
146 | catch (_com_error *e) {
147 | CString errormessage;
148 | errormessage.Format(L"数据库操作失败\r\n错误信息:%s", e->ErrorMessage());
149 | AfxMessageBox(errormessage, MB_ICONERROR);//显示错误信息
150 | if (m_pConnection->State)
151 | m_pConnection->Close();
152 | return;
153 | }
154 |
155 | if (m_pRecordset->State)
156 | m_pRecordset->Close();
157 |
158 |
159 | if (ACCEPTED == TRUE) {
160 | CDialog::OnOK();
161 | }
162 | else
163 | AfxMessageBox(L"用户名或密码错误", MB_RETRYCANCEL | MB_ICONSTOP);
164 | }
165 |
166 | //退出
167 | void CLogin::OnBnClickedCancel()
168 | {
169 | // TODO: 在此添加控件通知处理程序代码
170 | ACCEPTED = FALSE;
171 |
172 | CDialogEx::OnCancel();
173 | }
174 |
175 |
176 |
177 |
178 |
--------------------------------------------------------------------------------
/DeVision/CLogin.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | // CLogin 对话框
6 |
7 | class CLogin : public CDialogEx
8 | {
9 | DECLARE_DYNAMIC(CLogin)
10 |
11 | public:
12 | CLogin(CWnd* pParent = nullptr); // 标准构造函数
13 | virtual ~CLogin();
14 |
15 | // 对话框数据
16 | #ifdef AFX_DESIGN_TIME
17 | enum { IDD = IDD_DIALOG_LOGIN };
18 | #endif
19 |
20 | protected:
21 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
22 |
23 | DECLARE_MESSAGE_MAP()
24 |
25 |
26 | public:
27 | BOOL ACCEPTED;
28 | CString m_logo_name;
29 |
30 | private:
31 | _ConnectionPtr m_pConnection;
32 | _RecordsetPtr m_pRecordset;
33 | _CommandPtr m_pCommand;
34 |
35 | std::string m_strname;
36 | std::string m_strpassword;
37 |
38 | public:
39 | afx_msg void OnBnClickedOk();
40 | afx_msg void OnBnClickedCancel();
41 | CEdit m_edit_name;
42 | CEdit m_edit_password;
43 | virtual BOOL OnInitDialog();
44 | afx_msg void OnDestroy();
45 | };
46 |
--------------------------------------------------------------------------------
/DeVision/CMyDocument.cpp:
--------------------------------------------------------------------------------
1 | // CMyDocument.cpp: 实现文件
2 | //
3 |
4 | //#include "pch.h"
5 | #include "stdafx.h"
6 | #include "DeVision.h"
7 | #include "CMyDocument.h"
8 |
9 |
10 | // CMyDocument
11 |
12 | IMPLEMENT_DYNCREATE(CMyDocument, CDocument)
13 |
14 | CMyDocument::CMyDocument()
15 | {
16 | }
17 |
18 | BOOL CMyDocument::OnNewDocument()
19 | {
20 | if (!CDocument::OnNewDocument())
21 | return FALSE;
22 | return TRUE;
23 | }
24 |
25 | CMyDocument::~CMyDocument()
26 | {
27 | }
28 |
29 |
30 | BEGIN_MESSAGE_MAP(CMyDocument, CDocument)
31 | END_MESSAGE_MAP()
32 |
33 |
34 | // CMyDocument 诊断
35 |
36 | #ifdef _DEBUG
37 | void CMyDocument::AssertValid() const
38 | {
39 | CDocument::AssertValid();
40 | }
41 |
42 | #ifndef _WIN32_WCE
43 | void CMyDocument::Dump(CDumpContext& dc) const
44 | {
45 | CDocument::Dump(dc);
46 | }
47 | #endif
48 | #endif //_DEBUG
49 |
50 | #ifndef _WIN32_WCE
51 | // CMyDocument 序列化
52 |
53 | void CMyDocument::Serialize(CArchive& ar)
54 | {
55 | if (ar.IsStoring())
56 | {
57 | // TODO: 在此添加存储代码
58 | }
59 | else
60 | {
61 | // TODO: 在此添加加载代码
62 | }
63 | }
64 | #endif
65 |
66 |
67 | // CMyDocument 命令
68 |
--------------------------------------------------------------------------------
/DeVision/CMyDocument.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // CMyDocument document
4 | class CDialogView;
5 |
6 | class CMyDocument : public CDocument
7 | {
8 | //DECLARE_DYNCREATE(CMyDocument)
9 | friend class CDialogView;
10 |
11 | public:
12 | CMyDocument();
13 | DECLARE_DYNCREATE(CMyDocument)
14 | public:
15 | virtual ~CMyDocument();
16 | #ifndef _WIN32_WCE
17 | virtual void Serialize(CArchive& ar);// overridden for document i/o
18 | #endif
19 | #ifdef _DEBUG
20 | virtual void AssertValid() const;
21 | #ifndef _WIN32_WCE
22 | virtual void Dump(CDumpContext& dc) const;
23 | #endif
24 | #endif
25 |
26 | protected:
27 | virtual BOOL OnNewDocument();
28 |
29 | DECLARE_MESSAGE_MAP()
30 | };
31 |
--------------------------------------------------------------------------------
/DeVision/CMyView.cpp:
--------------------------------------------------------------------------------
1 | // CMyView.cpp: 实现文件
2 | //
3 |
4 | //#include "pch.h"
5 | #include "stdafx.h"
6 | #include "DeVision.h"
7 | //#include "DeVisionDlg.h"
8 | #include "CMyView.h"
9 |
10 | IMPLEMENT_DYNCREATE(CMyView, CScrollView)
11 |
12 | CMyView::CMyView()
13 | {
14 | m_acolor[0] = RGB(255, 35, 15);
15 | m_acolor[1] = RGB(25, 255, 35);
16 | m_acolor[2] = RGB(35, 55, 225);
17 | m_acolor[3] = RGB(255, 255, 0);
18 |
19 | for (INT i = 0; i < 4; i++) {m_bFlagShow[i] = true;}
20 |
21 | }
22 |
23 | CMyView::~CMyView()
24 | {
25 | }
26 |
27 | BEGIN_MESSAGE_MAP(CMyView, CScrollView)
28 |
29 | ON_WM_ERASEBKGND()
30 | END_MESSAGE_MAP()
31 |
32 | // CMyView 绘图
33 | void CMyView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
34 | {
35 | // TODO: 在此添加专用代码和/或调用基类
36 | m_nMapMode = MM_TEXT; //映射模式,解决 scrollToPosition错误
37 |
38 | CScrollView::OnPrepareDC(pDC, pInfo);
39 | }
40 |
41 | void CMyView::OnInitialUpdate()
42 | {
43 | CScrollView::OnInitialUpdate();
44 |
45 | CSize sizeTotal;
46 | // TODO: 计算此视图的合计大小
47 | sizeTotal.cx = (LONG)(wnd_width * 0.9);
48 | sizeTotal.cy = wnd_height * wnd_scroll_scale_size;
49 | SetScrollSizes(MM_TEXT, sizeTotal);
50 |
51 | //垂直滚动范围为:3米
52 | //此处的scale 的单位为: 米/像素
53 | scale_x = (float)sizeTotal.cx / (IMAGE_WIDTH * 4 * HORIZON_PRECISION);
54 | //scale_y = (float)DISPLAY_SCOPE / sizeTotal.cy;
55 | }
56 |
57 | BOOL CMyView::OnEraseBkgnd(CDC* pDC)
58 | {
59 | // TODO: 在此添加消息处理程序代码和/或调用默认值
60 |
61 | //return CScrollView::OnEraseBkgnd(pDC);
62 | //直接返回 true, 解决窗口闪烁问题
63 | return TRUE;
64 | }
65 |
66 | void CMyView::OnDraw(CDC* pDC)
67 | {
68 | //CDocument* pDoc = GetDocument();
69 | // TODO: 在此添加绘制代码
70 | //CRect rc;
71 | //GetClientRect(&rc);
72 | //CPoint pt = GetScrollPosition();
73 | //rc.OffsetRect(pt);
74 |
75 | //POINT pt_scroll;
76 | //pt_scroll.x = 0;
77 | //pt_scroll.y = (int)(std::abs(wnd_height * wnd_scroll_scale_size - m_previous_position / scale_y));
78 | //ScrollToPosition(pt_scroll);
79 |
80 | CDC MemDC; // 定义一个内存显示设备对象
81 | CBitmap MemBitmap; // 定义一个位图对象
82 | //建立与屏幕显示兼容的内存显示设备
83 | MemDC.CreateCompatibleDC(pDC);
84 | //建立一个与屏幕显示兼容的位图,位图的大小可选用窗口客户区的大小
85 | MemBitmap.CreateCompatibleBitmap(pDC, wnd_width, wnd_height*wnd_scroll_scale_size);
86 | //将位图选入到内存显示设备中,只有选入了位图的内存显示设备才有地方绘图,画到指定的位图上
87 | MemDC.SelectObject(&MemBitmap);
88 | //CBitmap *pOldBit = MemDC.SelectObject(&MemBitmap);
89 | //先用背景色将位图清除干净,否则是黑色。这里用的是白色作为背景
90 | MemDC.FillSolidRect(0, 0, wnd_width, wnd_height * wnd_scroll_scale_size, RGB(128, 128, 128));
91 |
92 | //绘图部分
93 | MemDC.SelectObject(m_font);
94 | //AddFlag(MemDC);
95 | AddFlag(MemDC, 0);
96 |
97 | //将内存中的图拷贝到屏幕上进行显示
98 | pDC->BitBlt(0, 0, wnd_width, wnd_height * wnd_scroll_scale_size, &MemDC, 0, 0, SRCCOPY);
99 | //绘图完成后的清理
100 | //MemDC.SelectObject(pOldBit);
101 | MemBitmap.DeleteObject();
102 | MemDC.DeleteDC();
103 | }
104 |
105 | // CMyView 诊断
106 |
107 | #ifdef _DEBUG
108 | void CMyView::AssertValid() const
109 | {
110 | CScrollView::AssertValid();
111 | }
112 |
113 | #ifndef _WIN32_WCE
114 | void CMyView::Dump(CDumpContext& dc) const
115 | {
116 | CScrollView::Dump(dc);
117 | }
118 | #endif
119 | #endif //_DEBUG
120 |
121 | // CMyView 消息处理程序
122 |
123 | //Customer
124 | void CMyView::UpdateScreen(CFont &mfont, float display_range)
125 | {
126 | m_font = &mfont;
127 | m_display_range = display_range;
128 | scale_y = (float)display_range / (wnd_height * wnd_scroll_scale_size);
129 |
130 | //不自动滚屏的计算方式
131 | //scale_y = (float)(wnd_height * wnd_scroll_scale_size) / display_range;
132 |
133 | Invalidate();
134 | }
135 |
136 | void CMyView::CreateFlag(CDC &mDC, int x, int y, int kind)
137 | {
138 | switch (kind)
139 | {
140 | case 0: {
141 | if (m_bFlagShow[0]) {
142 | mDC.SetBkColor(m_acolor[0]);
143 | mDC.TextOutW(x, y, _T("A"));
144 | }
145 | break;
146 | }
147 | case 1: {
148 | if (m_bFlagShow[1]) {
149 | mDC.SetBkColor(m_acolor[1]);
150 | mDC.TextOutW(x, y, _T("B"));
151 | }
152 | break;
153 | }
154 | case 2: {
155 | if (m_bFlagShow[2]) {
156 | mDC.SetBkColor(m_acolor[2]);
157 | mDC.TextOutW(x, y, _T("C"));
158 | }
159 | break;
160 | }
161 | case 3: {
162 | if (m_bFlagShow[3]) {
163 | mDC.SetBkColor(m_acolor[3]);
164 | mDC.TextOutW(x, y, _T("D"));
165 | }
166 | break;
167 | }
168 | default: {
169 | mDC.SetBkColor(RGB(0, 0, 0));
170 | break;
171 | }
172 | }
173 | }
174 |
175 | // 方法二
176 | void CMyView::AddFlag(CDC &mDC, int test)
177 | {
178 | DeffectInfo info;
179 | if (!m_pvecDFT->empty()) {
180 | int x_coord = 0, y_coord = 0;
181 | std::vector::reverse_iterator rit = m_pvecDFT->rbegin();
182 | for (; rit != m_pvecDFT->rend(); ++rit) {
183 | info = *rit;
184 | x_coord = (int)(info.x * scale_x);
185 | y_coord = wnd_height * wnd_scroll_scale_size - (int)((info.y - m_previous_position) / scale_y);
186 | if (y_coord < 0)
187 | m_previous_position = info.y - m_display_range;
188 | if (y_coord > wnd_height * wnd_scroll_scale_size)
189 | break;
190 |
191 | CreateFlag(mDC, x_coord, y_coord, info.type);
192 | }
193 | }
194 | }
195 |
196 | void CMyView::Redraw()
197 | {
198 | scale_y = 0.0f;
199 | m_display_range = 0.0f;
200 | m_previous_position = 0.0f;
201 | m_pvecDFT->clear();
202 | }
--------------------------------------------------------------------------------
/DeVision/CMyView.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "CImageProcessing.h"
5 |
6 | // CMyView view
7 | class CDialogView;
8 |
9 | class CMyView : public CScrollView
10 | {
11 | //DECLARE_DYNCREATE(CMyView)
12 | friend class CDialogView;
13 | protected:
14 | CMyView();// protected constructor used by dynamic creation
15 | DECLARE_DYNCREATE(CMyView)
16 | virtual ~CMyView();
17 |
18 | public:
19 | #ifdef _DEBUG
20 | virtual void AssertValid() const;
21 | #ifndef _WIN32_WCE
22 | virtual void Dump(CDumpContext& dc) const;
23 | #endif
24 | #endif
25 |
26 | public:
27 | void UpdateScreen(CFont &mfont, float display_range);
28 | void Redraw();
29 |
30 | int wnd_width;
31 | int wnd_height;
32 | int wnd_scroll_scale_size; //窗口滚动范围
33 | unsigned m_unDisplayRangeIndex;
34 |
35 | //std::vector m_vDefect;
36 | std::vector *m_pvecDFT;
37 | COLORREF m_acolor[4];
38 | bool m_bFlagShow[4];
39 |
40 | private:
41 | float scale_x = 0.0f;
42 | float scale_y = 0.0f;
43 |
44 | //float m_current_position = 0.0f; //当前检测位置,单位: 米
45 | float m_previous_position = 0.0f; //前次刷新位置
46 | float m_display_range = 0.0f;
47 | CFont *m_font;
48 | void AddFlag(CDC &mDC, int test);
49 | void CreateFlag(CDC &mDC, int x, int y, int kind);
50 |
51 | public:
52 | virtual void OnDraw(CDC* pDC);// overridden to draw this view
53 | virtual void OnInitialUpdate();// first time after construct
54 |
55 | DECLARE_MESSAGE_MAP()
56 |
57 | virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
58 | afx_msg BOOL OnEraseBkgnd(CDC* pDC);
59 | };
60 |
--------------------------------------------------------------------------------
/DeVision/CPlotArea.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CPlotArea.h
--------------------------------------------------------------------------------
/DeVision/CPoint0.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CPoint0.h
--------------------------------------------------------------------------------
/DeVision/CPoints.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CPoints.h
--------------------------------------------------------------------------------
/DeVision/CProductInfo.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 |
6 | // CProductInfo 对话框
7 |
8 | class CProductInfo : public CDialogEx
9 | {
10 | DECLARE_DYNAMIC(CProductInfo)
11 |
12 | public:
13 | CProductInfo(CWnd* pParent = nullptr); // 标准构造函数
14 | virtual ~CProductInfo();
15 |
16 | // 对话框数据
17 | #ifdef AFX_DESIGN_TIME
18 | enum { IDD = IDD_DIALOG_PRODUCTINFO };
19 | #endif
20 |
21 | protected:
22 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
23 |
24 |
25 | private:
26 | DECLARE_MESSAGE_MAP()
27 |
28 | public:
29 | HWND hMainWnd; //主窗口句柄
30 | BOOL m_bSave_Parameter = FALSE; //是否保存
31 |
32 | LPCWSTR APPNAME = L"ProductInfo";
33 | LPCWSTR FILEPATH = L"inis\\ProductInformation.ini";
34 |
35 |
36 | void UpdateControls();
37 | void LoadInifile();
38 | void SaveAll();
39 |
40 | public:
41 | int m_nBatchIndex;
42 | CString m_cstrBatchTime;
43 | CString m_cstrBatchCode;
44 | CString m_cstrBatch;
45 | CString m_cstrName;
46 | CString m_cstrSchedule;
47 | CString m_cstrAddition;
48 |
49 | CString GetTimeStamp();
50 | CString GenerateBatchNumber();
51 |
52 |
53 | afx_msg BOOL OnInitDialog();
54 | afx_msg void OnClose();
55 | afx_msg void OnBnClickedOk();
56 | afx_msg void OnBnClickedCancel();
57 | afx_msg void OnBnClickedBtnIndexChange();
58 | afx_msg void OnEnKillfocusEditInfoName();
59 | afx_msg void OnEnKillfocusEditSchedule();
60 | afx_msg void OnEnKillfocusEditInfoNo();
61 | afx_msg void OnEnKillfocusEditAddition();
62 | afx_msg void OnEnKillfocusEditNoIndex();
63 | };
--------------------------------------------------------------------------------
/DeVision/CRange.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CRange.h
--------------------------------------------------------------------------------
/DeVision/CRemote.cpp:
--------------------------------------------------------------------------------
1 | // CRemote.cpp: 实现文件
2 | //
3 |
4 | #include "stdafx.h"
5 | #include "DeVision.h"
6 | #include "CRemote.h"
7 | #include "afxdialogex.h"
8 |
9 |
10 | // CRemote 对话框
11 |
12 | IMPLEMENT_DYNAMIC(CRemote, CDialogEx)
13 |
14 | CRemote::CRemote(CWnd* pParent /*=nullptr*/)
15 | : CDialogEx(IDD_DIALOG_REMOTE, pParent)
16 | {
17 |
18 | }
19 |
20 | CRemote::~CRemote()
21 | {
22 | }
23 |
24 | void CRemote::DoDataExchange(CDataExchange* pDX)
25 | {
26 | CDialogEx::DoDataExchange(pDX);
27 | }
28 |
29 |
30 | BEGIN_MESSAGE_MAP(CRemote, CDialogEx)
31 | ON_WM_CLOSE()
32 | ON_BN_CLICKED(IDOK, &CRemote::OnBnClickedOk)
33 | ON_BN_CLICKED(IDCANCEL, &CRemote::OnBnClickedCancel)
34 | END_MESSAGE_MAP()
35 |
36 |
37 | // CRemote 消息处理程序
38 |
39 |
40 |
41 | BOOL CRemote::OnInitDialog()
42 | {
43 | CDialogEx::OnInitDialog();
44 |
45 | // TODO: 在此添加额外的初始化
46 |
47 | return TRUE; // return TRUE unless you set the focus to a control
48 | // 异常: OCX 属性页应返回 FALSE
49 | }
50 |
51 |
52 | void CRemote::OnClose()
53 | {
54 | // TODO: 在此添加消息处理程序代码和/或调用默认值
55 | if (AfxMessageBox(_T("是否保存?"), MB_YESNO | MB_ICONWARNING) == IDYES) {
56 |
57 |
58 | }
59 |
60 | CDialogEx::OnClose();
61 | }
62 |
63 |
64 | void CRemote::OnBnClickedOk()
65 | {
66 | // TODO: 在此添加控件通知处理程序代码
67 | //CDialogEx::OnOK();
68 | }
69 |
70 |
71 | void CRemote::OnBnClickedCancel()
72 | {
73 | // TODO: 在此添加控件通知处理程序代码
74 | CDialogEx::OnCancel();
75 | }
76 |
--------------------------------------------------------------------------------
/DeVision/CRemote.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 |
4 | // CRemote 对话框
5 |
6 | class CRemote : public CDialogEx
7 | {
8 | DECLARE_DYNAMIC(CRemote)
9 |
10 | public:
11 | CRemote(CWnd* pParent = nullptr); // 标准构造函数
12 | virtual ~CRemote();
13 |
14 | // 对话框数据
15 | #ifdef AFX_DESIGN_TIME
16 | enum { IDD = IDD_DIALOG_REMOTE };
17 | #endif
18 |
19 | protected:
20 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
21 |
22 | DECLARE_MESSAGE_MAP()
23 | public:
24 | virtual BOOL OnInitDialog();
25 | afx_msg void OnClose();
26 | afx_msg void OnBnClickedOk();
27 | afx_msg void OnBnClickedCancel();
28 | };
29 |
--------------------------------------------------------------------------------
/DeVision/CSetupDlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | // CSetupDlg 对话框
7 |
8 | class CSetupDlg : public CDialogEx
9 | {
10 | DECLARE_DYNAMIC(CSetupDlg)
11 |
12 | public:
13 | CSetupDlg(CWnd* pParent = nullptr); // 标准构造函数
14 | virtual ~CSetupDlg();
15 |
16 | // 对话框数据
17 | #ifdef AFX_DESIGN_TIME
18 | enum { IDD = IDD_DIALOG_SETUP };
19 | #endif
20 |
21 | protected:
22 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
23 |
24 | DECLARE_MESSAGE_MAP()
25 |
26 | public:
27 | HWND hMainWnd; //主窗口句柄
28 |
29 | BOOL m_bSave_Parameter = FALSE; //是否保存
30 | float m_wnd1_range = 0.0f;
31 | float m_wnd2_range = 0.0f;
32 | float m_k_speed = 0.0f; //速度修正系数
33 | int m_threadnum = 1;
34 | BOOL m_bSaveRefImg = FALSE;
35 |
36 | std::string m_strDeffect_Path = "";
37 | std::string m_strTable_Path = "";
38 |
39 | private:
40 | BOOL ACCEPTED;
41 | CString m_current_logged_name;
42 |
43 | float GetWnd1DisplayRange();
44 | float GetWnd2DisplayRange();
45 | float GetKSpeed();
46 | int GetThreadNumber();
47 |
48 | BOOL ConnectAccess();
49 | _ConnectionPtr m_pConnection;
50 | _RecordsetPtr m_pRecordset;
51 | //_CommandPtr m_pCommand;
52 |
53 | public:
54 | virtual BOOL OnInitDialog();
55 | virtual BOOL DestroyWindow();
56 | afx_msg void OnClose();
57 | virtual void OnOK();
58 | afx_msg void OnBnClickedButtonSetupLogin();
59 | afx_msg void OnBnClickedButtonAddUser();
60 | afx_msg void OnBnClickedButtonSetupChange();
61 | afx_msg void OnBnClickedButtonSetupDelete();
62 | CComboBox m_combo_threadnum;
63 | CButton m_save_reference_image;
64 | afx_msg void OnBnClickedButtonSelectDeffectPath();
65 | afx_msg void OnBnClickedButtonTablePath();
66 | afx_msg void OnBnClickedButtonSystemReset();
67 | };
68 |
--------------------------------------------------------------------------------
/DeVision/CShape.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CShape.h
--------------------------------------------------------------------------------
/DeVision/CShapeRange.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CShapeRange.h
--------------------------------------------------------------------------------
/DeVision/CShapes.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CShapes.h
--------------------------------------------------------------------------------
/DeVision/CTableDlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include "CInspectDlg.h"
6 |
7 |
8 |
9 | // CTableDlg 对话框
10 |
11 | class CTableDlg : public CDialogEx
12 | {
13 | DECLARE_DYNAMIC(CTableDlg)
14 |
15 | public:
16 | CTableDlg(CWnd* pParent = nullptr); // 标准构造函数
17 | virtual ~CTableDlg();
18 |
19 | // 对话框数据
20 | #ifdef AFX_DESIGN_TIME
21 | enum { IDD = IDD_DIALOG_TABLE };
22 | #endif
23 |
24 | public:
25 | HWND hMainWnd; //主窗口句柄
26 | int m_iSystemState; //系统状态
27 | std::string m_DFT_img_path;
28 | std::string m_save_path;
29 | std::wstring m_wstr_batch; //批号
30 | std::wstring m_wstr_name; //型号
31 | std::wstring m_wstr_schedule; //班次
32 | std::wstring m_wstr_addition; //备注
33 | std::wstring m_wstr_width;
34 | std::wstring m_wstr_length; //长度
35 | std::wstring m_wstr_speed; //平均速度
36 | int m_product_rank; //产品评级
37 | int m_DFT_rank[5]; //每种瑕疵类型的个数统计
38 | int m_serious_num; //D级缺陷数目
39 |
40 |
41 | void RefrushDistributeWnd();
42 | void GetDetectResult(int rank0, int rank1, int rank2, int rank3, int rank4);
43 | void DrawTable(CDC *mDC, CRect rect, float x, float y);
44 | void CreateFlag(CDC *mDC, int x, int y, int kind);
45 | void DrawAllFlag(CDC *mDC, int wnd_width, int wnd_height);
46 | void DrawSelectDFT(CDC *mDC, int x, int y);
47 | void AddToDetailList(int NO, int kind, float position, float radius, int rank);
48 | void SaveDistributeImage();
49 | HBITMAP GetSrcBit(HDC hDC, LPRECT rEct);
50 | bool SaveBMPToFile(HBITMAP hBitmap, LPSTR lpFileName);
51 | bool SaveBitmapToFile(HBITMAP hBitmap, const char* name);
52 | void SaveToExcel(std::vector vDFT);
53 | void SaveToExcelUseDefault(CString &name);
54 | void SaveScatterPlotUseDefault();
55 | void FormatTableHead(CWorksheet &sheet, CRange &range, BOOL bhead);
56 | void BeginSaveTable();
57 |
58 | CFont m_font;
59 | std::vector *m_pvDFT; // 用于显示分布图
60 | std::vector m_vecDFT; // 用于写入报表
61 | float m_current_position;
62 | float scale_x;
63 | float scale_y;
64 |
65 | CEvent TableSaved_Event;
66 |
67 | CRITICAL_SECTION m_csvec; //定义一个临界区
68 |
69 | private:
70 | CPen m_pen[7];
71 | COLORREF red_color = RGB(255, 35, 15); //红色
72 | COLORREF green_color = RGB(25, 255, 35); //绿色
73 | COLORREF blue_color = RGB(35, 55, 225); //蓝色
74 | COLORREF yellow_color = RGB(255, 255, 0); //黄色
75 |
76 | int m_selected_x = 0;
77 | int m_selected_y = 0;
78 | CDC m_memTablePaintDC; // 内存DC
79 | CRect m_rectTableControl;
80 | CWinThread *m_pDrawTableThread;
81 | bool m_bTableThreadAlive;
82 | static UINT userDrawTable(LPVOID pParam);
83 |
84 |
85 | std::wstring m_wstr_savetime; //保存时间
86 | CWinThread *m_SaveTable;
87 | static UINT SaveTableThreadDefault(LPVOID pParam);
88 | HBITMAP m_hbitmap;
89 | void GenerateReportName(std::wstring &wstrname);
90 | void InitialHistoryList();
91 | void InitialDetailList();
92 | CString GenerateRankText(int rank);
93 | std::vector m_vstring;
94 | void GetExcelsInfo(std::string filename, std::string &time, std::string &number,
95 | std::string &ID, std::string &longth, std::string &operators);
96 |
97 | CString m_current_excel_name; //当前使用的 excel 的文件名
98 | void OpenExcelFile(std::wstring excelname);
99 | void ShowBitmap(CWnd *pWnd, CString BmpName);
100 |
101 | protected:
102 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
103 |
104 | DECLARE_MESSAGE_MAP()
105 | public:
106 | CListCtrl m_ListCtrlHis;
107 | CListCtrl m_ListCtrlDetail;
108 | CComboBox m_comSearchOption;
109 | CEdit m_editSearchWord;
110 | CButton m_open_inprogram;
111 |
112 | virtual BOOL OnInitDialog();
113 |
114 | afx_msg void OnBnClickedBtnRefrush();
115 | afx_msg void OnPaint();
116 | afx_msg void OnPaintClipboard(CWnd* pClipAppWnd, HGLOBAL hPaintStruct);
117 | afx_msg void OnBnClickedButtonSearch();
118 | afx_msg BOOL OnEraseBkgnd(CDC* pDC);
119 | afx_msg void OnBnClickedButtonShowall();
120 | afx_msg void OnBnClickedButtonDelselect();
121 | afx_msg void OnBnClickedButtonDelall();
122 | afx_msg void OnBnClickedButtonPrint();
123 | afx_msg void OnBnClickedButtonSaveas();
124 | afx_msg void OnBnClickedButtonOpenexcel();
125 | afx_msg void OnBnClickedButtonOpeninprogram();
126 | afx_msg void OnBnClickedButtonOpenexcelpath();
127 | afx_msg void OnDestroy();
128 | afx_msg void OnNMDblclkListDetail(NMHDR *pNMHDR, LRESULT *pResult);
129 | afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
130 | afx_msg void OnSize(UINT nType, int cx, int cy);
131 | afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
132 | };
133 |
--------------------------------------------------------------------------------
/DeVision/CWorkbook.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CWorkbook.h
--------------------------------------------------------------------------------
/DeVision/CWorkbooks.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CWorkbooks.h
--------------------------------------------------------------------------------
/DeVision/CWorksheet.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CWorksheet.h
--------------------------------------------------------------------------------
/DeVision/CWorksheets.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/CWorksheets.h
--------------------------------------------------------------------------------
/DeVision/DeVision.cpp:
--------------------------------------------------------------------------------
1 |
2 | // DeVision.cpp: 定义应用程序的类行为。
3 | //
4 |
5 | #include "stdafx.h"
6 | #include "DeVision.h"
7 | #include "DeVisionDlg.h"
8 |
9 | #ifdef _DEBUG
10 | #define new DEBUG_NEW
11 | #endif
12 |
13 |
14 | // CDeVisionApp
15 |
16 | BEGIN_MESSAGE_MAP(CDeVisionApp, CWinApp)
17 | ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
18 | END_MESSAGE_MAP()
19 |
20 |
21 | // CDeVisionApp 构造
22 |
23 | CDeVisionApp::CDeVisionApp()
24 | {
25 | // 支持重新启动管理器
26 | m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
27 |
28 | // TODO: 在此处添加构造代码,
29 | // 将所有重要的初始化放置在 InitInstance 中
30 | }
31 |
32 |
33 | // 唯一的 CDeVisionApp 对象
34 |
35 | CDeVisionApp theApp;
36 |
37 |
38 | // CDeVisionApp 初始化
39 |
40 | BOOL CDeVisionApp::InitInstance()
41 | {
42 | // 如果一个运行在 Windows XP 上的应用程序清单指定要
43 | // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
44 | //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
45 | INITCOMMONCONTROLSEX InitCtrls;
46 | InitCtrls.dwSize = sizeof(InitCtrls);
47 | // 将它设置为包括所有要在应用程序中使用的
48 | // 公共控件类。
49 | InitCtrls.dwICC = ICC_WIN95_CLASSES;
50 | InitCommonControlsEx(&InitCtrls);
51 |
52 | CWinApp::InitInstance();
53 |
54 | AfxEnableControlContainer();
55 |
56 | // 创建 shell 管理器,以防对话框包含
57 | // 任何 shell 树视图控件或 shell 列表视图控件。
58 | CShellManager *pShellManager = new CShellManager;
59 |
60 | // 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
61 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
62 |
63 | // 标准初始化
64 | // 如果未使用这些功能并希望减小
65 | // 最终可执行文件的大小,则应移除下列
66 | // 不需要的特定初始化例程
67 | // 更改用于存储设置的注册表项
68 | // TODO: 应适当修改该字符串,
69 | // 例如修改为公司或组织名
70 | SetRegistryKey(_T("DeffectDetect"));
71 |
72 | //显示加载界面
73 | CLoad wndLoad;
74 | wndLoad.Create(IDB_BITMAP_LOADDING);
75 | wndLoad.UpdateWindow();
76 | HWND hwnd = wndLoad.GetSafeHwnd();
77 |
78 | //初始化 Excel COM组件
79 | if (CoInitialize(NULL) != 0) {
80 | AfxMessageBox(_T("初始化Excel失败"));
81 | return FALSE;
82 | }
83 |
84 | //这就是初始化Access COM库
85 | if (!AfxOleInit()){
86 | AfxMessageBox(L"OLE初始化失败!");
87 | return FALSE;
88 | }
89 |
90 |
91 | CDeVisionDlg dlg;
92 | m_pMainWnd = &dlg;
93 |
94 | //关闭加载界面
95 | DestroyWindow(hwnd);
96 |
97 | INT_PTR nResponse = dlg.DoModal();
98 | if (nResponse == IDOK)
99 | {
100 | // TODO: 在此放置处理何时用
101 | // “确定”来关闭对话框的代码
102 | }
103 | else if (nResponse == IDCANCEL)
104 | {
105 | // TODO: 在此放置处理何时用
106 | // “取消”来关闭对话框的代码
107 | }
108 | else if (nResponse == -1)
109 | {
110 | TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
111 | TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
112 | }
113 |
114 | // 删除上面创建的 shell 管理器。
115 | if (pShellManager != nullptr)
116 | {
117 | delete pShellManager;
118 | }
119 |
120 | #if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
121 | ControlBarCleanUp();
122 | #endif
123 |
124 | // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
125 | // 而不是启动应用程序的消息泵。
126 | return FALSE;
127 | }
128 |
129 |
130 |
131 |
132 | int CDeVisionApp::ExitInstance()
133 | {
134 | // TODO: 在此添加专用代码和/或调用基类
135 | CoUninitialize(); //释放com资源
136 |
137 | return CWinApp::ExitInstance();
138 | }
139 |
--------------------------------------------------------------------------------
/DeVision/DeVision.h:
--------------------------------------------------------------------------------
1 |
2 | // DeVision.h: PROJECT_NAME 应用程序的主头文件
3 | //
4 |
5 | #pragma once
6 |
7 | #ifndef __AFXWIN_H__
8 | #error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
9 | #endif
10 |
11 | #include "resource.h" // 主符号
12 |
13 | #include "CLoad.h"
14 |
15 | // CDeVisionApp:
16 | // 有关此类的实现,请参阅 DeVision.cpp
17 | //
18 |
19 | // 自定义消息
20 | //#define WM_LOGGING_MSG WM_USER+0x01001
21 | //#define WM_WARNING_MSG WM_USER+0x02001
22 | #define WM_LOGGING_MSG (WM_USER + 1)
23 | #define WM_WARNING_MSG (WM_USER + 2)
24 | #define WM_UPDATE_CONTROLS (WM_USER + 3)
25 | #define WM_UPDATE_HISTORY (WM_USER + 4)
26 | #define WM_UPDATE_MAINWND (WM_USER + 5)
27 | #define WM_SWITCHROLL (WM_USER + 6)
28 |
29 | #define STRINGLENGTH 64
30 | // 字节宽度
31 | #define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4);
32 | #define IMAGE_WIDTH 8192
33 | #define IMAGE_HEIGHT 8192
34 | // 纵向的精度, 单位: mm
35 | #define VERTICAL_PRECISION 0.035f
36 | // 横向的精度,单位: mm
37 | #define HORIZON_PRECISION 0.05f
38 |
39 | class CDeVisionApp : public CWinApp
40 | {
41 | public:
42 | CDeVisionApp();
43 |
44 | // 重写
45 | public:
46 | virtual BOOL InitInstance();
47 |
48 | // 实现
49 |
50 | DECLARE_MESSAGE_MAP()
51 | virtual int ExitInstance();
52 | };
53 |
54 | extern CDeVisionApp theApp;
55 |
--------------------------------------------------------------------------------
/DeVision/DeVision.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/DeVision.rc
--------------------------------------------------------------------------------
/DeVision/Halcon_18_11_S_debug_x64.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | C:\Program Files\MVTec\HALCON-18.11-Progress\include\halconcpp;C:\Program Files\MVTec\HALCON-18.11-Progress\include;$(IncludePath)
7 | C:\Program Files\MVTec\HALCON-18.11-Progress\lib\x64-win64;$(LibraryPath)
8 |
9 |
10 |
11 | C:\Program Files\MVTec\HALCON-18.11-Progress\lib\x64-win64;%(AdditionalLibraryDirectories)
12 | halconcpp.lib;%(AdditionalDependencies)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/DeVision/Halcon_18_11_S_release_x64.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | C:\Program Files\MVTec\HALCON-18.11-Progress\include\halconcpp;C:\Program Files\MVTec\HALCON-18.11-Progress\include;$(IncludePath)
7 | C:\Program Files\MVTec\HALCON-18.11-Progress\lib\x64-win64;$(LibraryPath)
8 |
9 |
10 |
11 | halconcpp.lib;%(AdditionalDependencies)
12 | C:\Program Files\MVTec\HALCON-18.11-Progress\lib\x64-win64;%(AdditionalLibraryDirectories)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/DeVision/ImportHalconCpp.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "HalconCpp.h"
4 | #include "HDevThread.h"
5 |
6 | using namespace HalconCpp;
7 |
8 | namespace HDevExportCpp
9 | {
10 | // Parallel execution wrapper for write_image(...)
11 | static void* _hcppthread_write_image(void *hcthread);
12 | }
13 |
14 | // Generated stubs for parallel procedure calls. Wrapped in name
15 | // space to avoid name conflicts with actual procedure names
16 | namespace HDevExportCpp
17 | {
18 | // Parallel execution wrapper for write_image(...)
19 | static void* _hcppthread_write_image(void *hcthread)
20 | {
21 | // +++ define thread context for this procedure
22 | HDevThread* hcppthread = (HDevThread*)hcthread;
23 | try
24 | {
25 | // Input parameters
26 | const HObject &cbho_Image = hcppthread->GetInputIconicParamObject(0);
27 | const HTuple &cbhv_Format = hcppthread->GetInputCtrlParamTuple(1);
28 | const HTuple &cbhv_FillColor = hcppthread->GetInputCtrlParamTuple(2);
29 | const HTuple &cbhv_FileName = hcppthread->GetInputCtrlParamTuple(3);
30 |
31 | // Call write_image
32 | WriteImage(cbho_Image, cbhv_Format, cbhv_FillColor, cbhv_FileName);
33 |
34 | // Reduce reference counter of thread object
35 | hcppthread->Exit();
36 | delete hcppthread;
37 |
38 | }
39 | catch (HException& exc)
40 | {
41 | // No exceptions may be raised from stub in parallel case,
42 | // so we need to store this information prior to cleanup
43 | bool is_direct_call = hcppthread->IsDirectCall();
44 | // Attempt to clean up in error case, too
45 | hcppthread->Exit();
46 | delete hcppthread;
47 | // Propagate exception if called directly
48 | if (is_direct_call)
49 | throw exc;
50 | }
51 | return NULL;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/DeVision/Log.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/Log.cpp
--------------------------------------------------------------------------------
/DeVision/Log.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Log.h
3 | // =====
4 | // It prints out any log messages to file or dialog box.
5 | // Log class is a singleton class which is contructed by calling
6 | // Log::getInstance() (lazy initialization), and is destructed automatically
7 | // when the application is terminated.
8 | //
9 | // In order to log, use Win::log() function with appropriate formats.
10 | // For example, Win::log(L"My number: %d\n", 123).
11 | // It is similar to printf() function of C standard libirary.
12 | //
13 | // The template of the log dialog window is defined in log.rc and logResource.h
14 | // You must include both resource file with this source codes.
15 | // The dialog window cannot be closed by user once it is created. But it will be
16 | // destroyed when the application terminated.
17 | //
18 | // AUTHOR: Song Ho Ahn (song.ahn@gmail.com)
19 | // CREATED: 2006-07-14
20 | // UPDATED: 2006-07-24
21 | ///////////////////////////////////////////////////////////////////////////////
22 |
23 | #ifndef WIN_LOG_H
24 | #define WIN_LOG_H
25 |
26 | #pragma warning(disable : 4996)
27 |
28 | #include
29 | #include
30 | #include
31 |
32 | namespace Win
33 | {
34 | enum { LOG_MODE_FILE = 0, LOG_MODE_DIALOG, LOG_MODE_BOTH }; // log output selection
35 | enum { LOG_MAX_STRING = 1024 };
36 |
37 | // Clients are actually use this functions to send log messages.
38 | // USAGE: Win::log("I am the number %d.", 1);
39 | void log(const std::wstring& str);
40 | void log(const wchar_t *format, ...);
41 | void log(const char *format, ...);
42 | extern void logMode(int mode);
43 |
44 |
45 |
46 | // singleton class ////////////////////////////////////////////////////////
47 | class Log
48 | {
49 | public:
50 | ~Log();
51 |
52 | static Log& getInstance(); // return reference to this class object
53 |
54 | void setMode(int mode); // set log target: file or dialog
55 | void put(const std::wstring& str); // print log message
56 |
57 | private:
58 | Log(); // hide it here to prevent instantiating this class
59 | Log(const Log& rhs); // must no body for copy ctor, so this class cannot have copy ctor
60 |
61 | const std::wstring getTime(); // return system time as string
62 | const std::wstring getDate(); // return system date as string
63 |
64 | int logMode; // file, dialog or both
65 | std::wofstream logFile; // log file handle
66 | HWND dialogHandle; // handle to dialog window
67 | HWND listHandle; // handle to listbox
68 | };
69 | ///////////////////////////////////////////////////////////////////////////
70 | }
71 |
72 | #endif
73 |
74 |
--------------------------------------------------------------------------------
/DeVision/SapClassGuiD.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/SapClassGuiD.lib
--------------------------------------------------------------------------------
/DeVision/SaperaLT84_x64_debug.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | C:\Program Files\Teledyne DALSA\Sapera\Classes\Gui;C:\Program Files\Teledyne DALSA\Sapera\Classes\Basic;C:\Program Files\Teledyne DALSA\Sapera\Include;%(AdditionalIncludeDirectories)
9 |
10 |
11 | C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64;C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64\VS2017;%(AdditionalLibraryDirectories)
12 | SapClassBasic.lib;SapClassGuiD.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/DeVision/SaperaLT84_x64_release.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | SapClassBasic.lib;SapClassGui.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
9 | C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64;C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64\VS2017;%(AdditionalLibraryDirectories)
10 |
11 |
12 | C:\Program Files\Teledyne DALSA\Sapera\Classes\Basic;C:\Program Files\Teledyne DALSA\Sapera\Classes\Gui;C:\Program Files\Teledyne DALSA\Sapera\Include;%(AdditionalIncludeDirectories)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/DeVision/SerialPort.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/SerialPort.cpp
--------------------------------------------------------------------------------
/DeVision/SerialPort.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/SerialPort.h
--------------------------------------------------------------------------------
/DeVision/Text.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/Text.cpp
--------------------------------------------------------------------------------
/DeVision/Text.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 |
4 | // text bank
5 | class TextBank
6 | {
7 | private:
8 | static const char HexTable[17];
9 | int ByteCnt;
10 | CString DataStr;
11 | public:
12 | TextBank(void);
13 | virtual ~TextBank();
14 |
15 | void AppendString(CString &mStr, bool isHexFormat = false);
16 | void ReString(CString &mStr, bool isHexFormat = false);
17 | unsigned char ValueOfString(LPCTSTR buffer);
18 |
19 | const CString &GetCStrData(void)
20 | {
21 | return DataStr;
22 | }
23 |
24 | unsigned int GetLength(void)
25 | {
26 | return ByteCnt;
27 | }
28 |
29 | void ClearData(void)
30 | {
31 | DataStr.Empty();
32 | ByteCnt = 0;
33 | }
34 |
35 | static int isHexChar(char ch)
36 | {
37 | if ((ch <= '9' && ch >= '0')
38 | || (ch <= 'F' && ch >= 'A')
39 | || (ch <= 'f' && ch >= 'a'))
40 | return 1;
41 | else if (ch == ' ')
42 | return 2;
43 | else
44 | return 0;
45 | }
46 |
47 | };
48 |
--------------------------------------------------------------------------------
/DeVision/UBase.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 |
6 | // register global message
7 | // at *.h file: afx_msg LRESULT OnMyReceiveMsg(WPARAM wParam, LPARAM lParam);
8 | // at *.cpp file: ON_REGISTERED_MESSAGE(WM_MYONRECVMSG, OnMyReceiveMsg)
9 | // implement this method in the class
10 | const UINT WM_MYONRECVMSG = ::RegisterWindowMessage(_T("ONRECEIVE"));
11 |
12 | #define WH_MASK 0xFFFF0000
13 | #define WL_MASK 0x0000FFFF
14 | #define WKIND_MASK 0x000F0000
15 | #define WH_UCOM_UART 0x00010000
16 | #define WH_UCOM_NET 0x00020000
17 | #define WH_UCOM_SUBNET 0x00120000
18 |
19 | #define WL_UCOM_OPEN 0x00000001
20 | #define WL_UCOM_CLOSE 0x00000002
21 | #define WL_UCOM_RECV 0x00000003
22 |
23 | #define W_UART_RECV 0x00010003
24 | #define W_NET_RECV 0x00020003
25 | #define W_SUBNET_RECV 0x00120003
26 |
27 | #define W_SUBNET_OPEN 0x00120004
28 | #define W_SUBNET_CLOSE 0x00120005
29 |
30 |
31 | // custom message
32 | #define WM_NETDLG_MSG (WM_USER + 2)
33 | #define WM_UARTDLG_MSG (WM_USER + 3)
34 |
35 |
36 | // abstract of async send and read
37 | class UcomBase
38 | {
39 | public:
40 | UcomBase() {
41 | }
42 | ~UcomBase() {
43 |
44 | }
45 | virtual int AsyncSend(const CString &dataStr) = 0;
46 | virtual int AsyncRead(CString &dataStr, CString & infoStr, WPARAM wParam, LPARAM lParam) = 0;
47 | virtual bool IsRWable (void) = 0;
48 | };
49 |
--------------------------------------------------------------------------------
/DeVision/help/0.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/0.PNG
--------------------------------------------------------------------------------
/DeVision/help/00.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/00.PNG
--------------------------------------------------------------------------------
/DeVision/help/01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/01.png
--------------------------------------------------------------------------------
/DeVision/help/1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/1.PNG
--------------------------------------------------------------------------------
/DeVision/help/1.软件介绍.mht:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/1.软件介绍.mht
--------------------------------------------------------------------------------
/DeVision/help/10.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/10.PNG
--------------------------------------------------------------------------------
/DeVision/help/11.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/11.PNG
--------------------------------------------------------------------------------
/DeVision/help/12.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/12.PNG
--------------------------------------------------------------------------------
/DeVision/help/13.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/13.PNG
--------------------------------------------------------------------------------
/DeVision/help/14.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/14.PNG
--------------------------------------------------------------------------------
/DeVision/help/15.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/15.PNG
--------------------------------------------------------------------------------
/DeVision/help/16.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/16.PNG
--------------------------------------------------------------------------------
/DeVision/help/2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/2.PNG
--------------------------------------------------------------------------------
/DeVision/help/2.登录.mht:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/2.登录.mht
--------------------------------------------------------------------------------
/DeVision/help/3.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/3.PNG
--------------------------------------------------------------------------------
/DeVision/help/3.菜单栏.mht:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/3.菜单栏.mht
--------------------------------------------------------------------------------
/DeVision/help/4.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/4.PNG
--------------------------------------------------------------------------------
/DeVision/help/4.工具栏.mht:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/4.工具栏.mht
--------------------------------------------------------------------------------
/DeVision/help/5.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/5.PNG
--------------------------------------------------------------------------------
/DeVision/help/5.瑕疵显示.mht:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/5.瑕疵显示.mht
--------------------------------------------------------------------------------
/DeVision/help/6.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/6.PNG
--------------------------------------------------------------------------------
/DeVision/help/6.页面切换.mht:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/6.页面切换.mht
--------------------------------------------------------------------------------
/DeVision/help/7.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/7.PNG
--------------------------------------------------------------------------------
/DeVision/help/7.状态栏.mht:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/7.状态栏.mht
--------------------------------------------------------------------------------
/DeVision/help/8.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/8.PNG
--------------------------------------------------------------------------------
/DeVision/help/9.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/9.PNG
--------------------------------------------------------------------------------
/DeVision/help/EasyCHM_Alias.h:
--------------------------------------------------------------------------------
1 | ;//Alias header file for CHM project
2 | ;//Automatically generated by Easy CHM.
3 | ;//Website : http://www.zipghost.com
4 | ;//Email : webmaster@zipghost.com
5 | ;//Date : 2020/6/11 12:56:43
6 |
7 | ;//NOTE:
8 | ;//All strings after the ";" are commnets, they will be ignored by the CHM Compiler.
9 |
10 |
--------------------------------------------------------------------------------
/DeVision/help/EasyCHM_Map.h:
--------------------------------------------------------------------------------
1 | ;//Map header file for CHM project
2 | ;//Automatically generated by Easy CHM.
3 | ;//Website : http://www.zipghost.com
4 | ;//Email : webmaster@zipghost.com
5 | ;//Date : 2020/6/11 12:56:43
6 |
7 | ;//NOTE:
8 | ;//All strings after the ";" are commnets, they will be ignored by the CHM Compiler.
9 |
10 |
--------------------------------------------------------------------------------
/DeVision/help/UserGuide.CHM:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/UserGuide.CHM
--------------------------------------------------------------------------------
/DeVision/help/主窗口.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/主窗口.PNG
--------------------------------------------------------------------------------
/DeVision/help/用户手册.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/用户手册.docx
--------------------------------------------------------------------------------
/DeVision/help/用户手册.mht:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/用户手册.mht
--------------------------------------------------------------------------------
/DeVision/help/首页.mht:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/help/首页.mht
--------------------------------------------------------------------------------
/DeVision/iUart.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/iUart.cpp
--------------------------------------------------------------------------------
/DeVision/iUart.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "UBase.h"
4 |
5 | #define IUART_BUFF_MAX 1024
6 |
7 | typedef struct
8 | {
9 | // serial-port HANDLE
10 | HANDLE *commHandle;
11 | // unused
12 | HWND hwParent;
13 | HWND hwTopParent;
14 | }ThreadPara;
15 |
16 |
17 | class iUart
18 | {
19 | private:
20 | HANDLE hUartCom;
21 | DCB uartConfig;
22 | CString ComName;
23 |
24 | OVERLAPPED m_osRead;
25 | OVERLAPPED m_osWrite;
26 | ThreadPara mThreadPara;
27 |
28 | HWND hwParent;
29 | HWND hwTopParent;
30 | public:
31 |
32 | iUart(){
33 | hUartCom = NULL;
34 | mThreadPara.commHandle = &hUartCom;
35 | }
36 | ~iUart();
37 |
38 | void ClosePort(void){
39 | CloseHandle(hUartCom);
40 | hUartCom = NULL;
41 | TRACE("Close PortHandle\n");
42 | }
43 |
44 | bool OpenCom(bool isBlockMode = true);
45 | bool ConfigUart(CString comName, DCB mConfig);
46 |
47 | void GetComList(CComboBox *cblist);
48 |
49 | int WriteCString(const CString &cBuffer);
50 | CString ReadCString(void);
51 |
52 | int UnblockRead(CString &dataStr);
53 | int UnblockSend(const CStringA &dataStr);
54 |
55 | void SetParentHWND(HWND pParent, HWND pTopParent)
56 | {
57 | hwParent = pParent;
58 | hwTopParent = pTopParent;
59 | }
60 |
61 | HANDLE GetHandle(void)
62 | {
63 | return hUartCom;
64 | }
65 |
66 | HANDLE* GetHandleAddr(void)
67 | {
68 | return &hUartCom;
69 | }
70 |
71 | bool isConnected(void)
72 | {
73 | if (hUartCom == NULL)
74 | return false;
75 | else
76 | return true;
77 | }
78 |
79 | ThreadPara *GetThreadStartPara(void)
80 | {
81 | mThreadPara.hwParent = hwParent;
82 | mThreadPara.hwTopParent = hwTopParent;
83 | return &mThreadPara;
84 | }
85 |
86 | };
87 |
88 |
89 | UINT RxThreadFunc(LPVOID mThreadPara);
90 |
--------------------------------------------------------------------------------
/DeVision/inis/ProductInformation.ini:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/inis/ProductInformation.ini
--------------------------------------------------------------------------------
/DeVision/inis/SystemInfo.ini:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/inis/SystemInfo.ini
--------------------------------------------------------------------------------
/DeVision/log.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "logResource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #include "afxres.h"
11 |
12 | /////////////////////////////////////////////////////////////////////////////
13 | #undef APSTUDIO_READONLY_SYMBOLS
14 |
15 | /////////////////////////////////////////////////////////////////////////////
16 | // English (U.S.) resources
17 |
18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19 | #ifdef _WIN32
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 | #pragma code_page(1252)
22 | #endif //_WIN32
23 |
24 | #ifdef APSTUDIO_INVOKED
25 | /////////////////////////////////////////////////////////////////////////////
26 | //
27 | // TEXTINCLUDE
28 | //
29 |
30 | 1 TEXTINCLUDE
31 | BEGIN
32 | "logResource.h\0"
33 | END
34 |
35 | 2 TEXTINCLUDE
36 | BEGIN
37 | "#include ""afxres.h""\r\n"
38 | "\0"
39 | END
40 |
41 | 3 TEXTINCLUDE
42 | BEGIN
43 | "\r\n"
44 | "\0"
45 | END
46 |
47 | #endif // APSTUDIO_INVOKED
48 |
49 |
50 | /////////////////////////////////////////////////////////////////////////////
51 | //
52 | // DESIGNINFO
53 | //
54 |
55 | #ifdef APSTUDIO_INVOKED
56 | GUIDELINES DESIGNINFO
57 | BEGIN
58 | IDD_LOG, DIALOG
59 | BEGIN
60 | LEFTMARGIN, 7
61 | RIGHTMARGIN, 343
62 | TOPMARGIN, 7
63 | BOTTOMMARGIN, 88
64 | END
65 | END
66 | #endif // APSTUDIO_INVOKED
67 |
68 |
69 | /////////////////////////////////////////////////////////////////////////////
70 | //
71 | // Dialog
72 | //
73 |
74 | IDD_LOG DIALOGEX 0, 0, 350, 95
75 | STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION
76 | CAPTION "Log Window"
77 | FONT 8, "MS Shell Dlg", 0, 0, 0x0
78 | BEGIN
79 | LISTBOX IDC_LIST_LOG,7,7,281,83,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
80 | PUSHBUTTON "Clear",IDC_BUTTON_CLEAR,294,48,50,14
81 | PUSHBUTTON "Minimize",IDC_BUTTON_MINIMIZE,294,72,50,14
82 | END
83 |
84 | #endif // English (U.S.) resources
85 | /////////////////////////////////////////////////////////////////////////////
86 |
87 |
88 |
89 | #ifndef APSTUDIO_INVOKED
90 | /////////////////////////////////////////////////////////////////////////////
91 | //
92 | // Generated from the TEXTINCLUDE 3 resource.
93 | //
94 |
95 |
96 | /////////////////////////////////////////////////////////////////////////////
97 | #endif // not APSTUDIO_INVOKED
98 |
99 |
--------------------------------------------------------------------------------
/DeVision/logResource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by log.rc
4 |
5 | // Next default values for new objects
6 | //
7 | #define IDD_LOG 201
8 | #define IDC_LIST_LOG 2001
9 | #define IDC_BUTTON_CLEAR 2002
10 | #define IDC_BUTTON_MINIMIZE 2003
11 |
12 |
13 | #ifdef APSTUDIO_INVOKED
14 | #ifndef APSTUDIO_READONLY_SYMBOLS
15 | #define _APS_NEXT_RESOURCE_VALUE 101
16 | #define _APS_NEXT_COMMAND_VALUE 40001
17 | #define _APS_NEXT_CONTROL_VALUE 1001
18 | #define _APS_NEXT_SYMED_VALUE 101
19 | #endif
20 | #endif
21 |
--------------------------------------------------------------------------------
/DeVision/msado15.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/msado15.dll
--------------------------------------------------------------------------------
/DeVision/res/DeVision.rc2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/DeVision.rc2
--------------------------------------------------------------------------------
/DeVision/res/bitmap3.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/bitmap3.bmp
--------------------------------------------------------------------------------
/DeVision/res/camera_in.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/camera_in.ico
--------------------------------------------------------------------------------
/DeVision/res/camera_out.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/camera_out.ico
--------------------------------------------------------------------------------
/DeVision/res/change.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/change.ico
--------------------------------------------------------------------------------
/DeVision/res/changeX.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/changeX.ico
--------------------------------------------------------------------------------
/DeVision/res/exit.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/exit.ico
--------------------------------------------------------------------------------
/DeVision/res/go_down.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/go_down.ico
--------------------------------------------------------------------------------
/DeVision/res/go_next.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/go_next.ico
--------------------------------------------------------------------------------
/DeVision/res/go_previous.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/go_previous.ico
--------------------------------------------------------------------------------
/DeVision/res/go_up.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/go_up.ico
--------------------------------------------------------------------------------
/DeVision/res/icon2.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/icon2.ico
--------------------------------------------------------------------------------
/DeVision/res/load.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/load.bmp
--------------------------------------------------------------------------------
/DeVision/res/lock.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/lock.ico
--------------------------------------------------------------------------------
/DeVision/res/loggin.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/loggin.ico
--------------------------------------------------------------------------------
/DeVision/res/login.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/login.ico
--------------------------------------------------------------------------------
/DeVision/res/logo128.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/logo128.ico
--------------------------------------------------------------------------------
/DeVision/res/logo32.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/logo32.ico
--------------------------------------------------------------------------------
/DeVision/res/logo64.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/logo64.ico
--------------------------------------------------------------------------------
/DeVision/res/offline.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/offline.ico
--------------------------------------------------------------------------------
/DeVision/res/online.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/online.ico
--------------------------------------------------------------------------------
/DeVision/res/pause.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/pause.ico
--------------------------------------------------------------------------------
/DeVision/res/process.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/process.gif
--------------------------------------------------------------------------------
/DeVision/res/start.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/start.ico
--------------------------------------------------------------------------------
/DeVision/res/start_ss.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/start_ss.ico
--------------------------------------------------------------------------------
/DeVision/res/stop.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/stop.ico
--------------------------------------------------------------------------------
/DeVision/res/unlock.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/res/unlock.ico
--------------------------------------------------------------------------------
/DeVision/stdafx.cpp:
--------------------------------------------------------------------------------
1 |
2 | // stdafx.cpp : 只包括标准包含文件的源文件
3 | // DeVision.pch 将作为预编译标头
4 | // stdafx.obj 将包含预编译类型信息
5 |
6 | #include "stdafx.h"
7 |
8 |
9 |
--------------------------------------------------------------------------------
/DeVision/stdafx.h:
--------------------------------------------------------------------------------
1 |
2 | // stdafx.h : 标准系统包含文件的包含文件,
3 | // 或是经常使用但不常更改的
4 | // 特定于项目的包含文件
5 |
6 | #pragma once
7 |
8 | #ifndef VC_EXTRALEAN
9 | #define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
10 | #endif
11 |
12 | #include "targetver.h"
13 |
14 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
15 |
16 | // 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
17 | #define _AFX_ALL_WARNINGS
18 |
19 | #include // MFC 核心组件和标准组件
20 | #include // MFC 扩展
21 |
22 |
23 | #include // MFC 自动化类
24 |
25 |
26 |
27 | #ifndef _AFX_NO_OLE_SUPPORT
28 | #include // MFC 对 Internet Explorer 4 公共控件的支持
29 | #endif
30 | #ifndef _AFX_NO_AFXCMN_SUPPORT
31 | #include // MFC 对 Windows 公共控件的支持
32 | #endif // _AFX_NO_AFXCMN_SUPPORT
33 |
34 | #include // 功能区和控件条的 MFC 支持
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 | #include
44 | #include
45 | #include
46 | #include
47 | #include
48 | #include
49 | #include
50 |
51 | #include "CApplication.h"
52 | #include "CAxes.h"
53 | #include "CAxis.h"
54 | #include "CBorder.h"
55 | #include "CChart.h"
56 | #include "CChartObject.h"
57 | #include "CChartObjects.h"
58 | #include "CCharts.h"
59 | #include "CFont0.h"
60 | #include "CGridlines.h"
61 | #include "CPlotArea.h"
62 | #include "CPoints.h"
63 | #include "CPoint0.h"
64 | #include "CRange.h"
65 | #include "CShape.h"
66 | #include "CShapes.h"
67 | #include "CShapeRange.h"
68 | #include "CWorkbook.h"
69 | #include "CWorkbooks.h"
70 | #include "CWorksheet.h"
71 | #include "CWorksheets.h"
72 | #include
73 | #include
74 | #include
75 | #include
76 |
77 |
78 | //#include
79 | //#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
80 | #import "msado15.dll" no_namespace rename("EOF","adoEOF")
81 |
82 |
83 |
84 | #ifdef _UNICODE
85 | #if defined _M_IX86
86 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
87 | #elif defined _M_X64
88 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
89 | #else
90 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
91 | #endif
92 | #endif
93 |
94 |
95 |
--------------------------------------------------------------------------------
/DeVision/system/ExampleModel.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/system/ExampleModel.xlsx
--------------------------------------------------------------------------------
/DeVision/system/Model.svm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/system/Model.svm
--------------------------------------------------------------------------------
/DeVision/system/T_LA_CM_08K08A_00_R_External.ccf:
--------------------------------------------------------------------------------
1 | [Board]
2 | Server Name=Xtium-CL_MX4
3 | Device Name=CameraLink Full Mono
4 | Device Index=0
5 | [General]
6 | Version=301
7 | Vic Name=Board4_CC1_AB
8 | Time Stamp Base=1
9 | Camera Name=External_Trigger
10 | Company Name=Teledyne DALSA
11 | Model Name=LA_CM_08K08A_00_R
12 | [Input]
13 | Bit Ordering=1
14 | Camera Selector=0
15 | Planar Input Sources=0
16 | [Signal Conditioning]
17 | Bayer Decoder Enable=0
18 | Bayer Decoder Method=0
19 | Bayer Decoder White Balance Gain Red=0
20 | Bayer Decoder White Balance Gain Green=0
21 | Bayer Decoder White Balance Gain Blue=0
22 | Bayer Decoder Saturation Factor=0
23 | Bayer Decoder Saturation Weight Red=0
24 | Bayer Decoder Saturation Weight Green=0
25 | Bayer Decoder Saturation Weight Blue=0
26 | Bayer Decoder White Balance Offset Red=0
27 | Bayer Decoder White Balance Offset Green=0
28 | Bayer Decoder White Balance Offset Blue=0
29 | Brightness=0
30 | Brightness Blue=0
31 | Brightness Green=0
32 | Brightness Red=0
33 | Contrast=100000
34 | Contrast Blue=100000
35 | Contrast Green=100000
36 | Contrast Red=100000
37 | DC Restoration Mode=1
38 | DC Restoration Start=0
39 | DC Restoration Width=0
40 | Fix Filter Enable=0
41 | Fix Filter Selector=0
42 | Hue=0
43 | Programmable Filter Enable=0
44 | Programmable Filter Frequency=5500000
45 | Saturation=100000
46 | Sharpness=0
47 | [Stream Conditioning]
48 | Crop Activation=0
49 | Crop Height=8192
50 | Crop Left=0
51 | Crop Top=0
52 | Crop Width=8192
53 | Decimate Count=0
54 | Decimate Method=1
55 | External Trigger Frame Count=1
56 | Flip=0
57 | Frame Length=1
58 | Horizontal Sync Reference=2
59 | Lut Enable=0
60 | Lut Number=0
61 | Pixel Mask=255
62 | Scale Horizontal=8192
63 | Scale Horizontal Method=1
64 | Scale Vertical=8192
65 | Scale Vertical Method=1
66 | Snap Count=1
67 | Vertical Sync Reference=2
68 | [Control Signals]
69 | Camera Control Pulse 0 HD Align=0
70 | Camera Control Pulse 1 HD Align=0
71 | Camera Frames Per Trigger=1
72 | Camera Reset Delay=0
73 | Camera Reset Enable=0
74 | Camera Trigger Delay=0
75 | Camera Trigger Enable=0
76 | Line Integrate Time Base=256
77 | Board Sync Output 1 Source=0
78 | Board Sync Output 2 Source=0
79 | External Frame Trigger Detection=8
80 | External Frame Trigger Enable=0
81 | External Frame Trigger Level=8
82 | External Frame Trigger Source=0
83 | External Line Trigger Detection=4
84 | External Line Trigger Enable=0
85 | External Line Trigger Level=2
86 | External Line Trigger Source=1
87 | External Trigger Detection=4
88 | External Trigger Delay=0
89 | External Trigger Delay Time Base=128
90 | External Trigger Duration=0
91 | External Trigger Enable=1
92 | External Trigger Ignore Delay=0
93 | External Trigger Ignore Region Duration=0
94 | External Trigger Level=8
95 | External Trigger Source=0
96 | Frame Integrate Count=1
97 | Frame Integrate Enable=0
98 | Internal Frame Trigger Enable=0
99 | Internal Frame Trigger Freq=30000
100 | Internal Line Trigger Enable=0
101 | Internal Line Trigger Freq=5000
102 | Line Integrate Duration=1
103 | Line Integrate Enable=0
104 | Line Trigger Enable=1
105 | Line Trigger Auto Delay=0
106 | LineScan Direction Output=1
107 | Master Mode=0
108 | Master Mode Horizontal Sync Polarity=1
109 | Master Mode Vertical Sync Polarity=1
110 | PoCL Enable=0
111 | Shaft Encoder Enable=1
112 | Shaft Encoder Pulse Drop=0
113 | Shaft Encoder Level=2
114 | Shaft Encoder Pulse Multiply=1
115 | Shaft Encoder Source=0
116 | Shaft Encoder Direction=0
117 | Shaft Encoder Order=0
118 | Strobe Delay=0
119 | Strobe Delay 2=0
120 | Strobe Duration=1
121 | Strobe Enable=0
122 | Strobe Level=1
123 | Strobe Method=0
124 | Strobe Polarity=1
125 | Time Integrate Duration=1
126 | Time Integrate Enable=0
127 | Time Integrate Delay=0
128 | Vertical Timeout Delay=0
129 | WEN Enable=0
130 | Camera Control During Readout=0
131 | Camera Line Trigger Frequency Minimum=1
132 | Camera Line Trigger Frequency Maximum=16777215
133 | Camera Reset Duration=1
134 | Camera Reset Method=0
135 | Camera Reset Polarity=1
136 | Camera Time Integrate Duration Minimum=1
137 | Camera Time Integrate Duration Maximum=85899345
138 | Camera Trigger Duration=1
139 | Camera Trigger Method=0
140 | Camera Trigger Polarity=1
141 | Data Valid Enable=0
142 | Data Valid Polarity=2
143 | Frame Integrate Method=0
144 | Frame Integrate Polarity=1
145 | Line Integrate Method=0
146 | Line Integrate Pulse 0 Delay=0
147 | Line Integrate Pulse 0 Duration=1
148 | Line Integrate Pulse 0 Polarity=1
149 | Line Integrate Pulse 1 Delay=0
150 | Line Integrate Pulse 1 Duration=1
151 | Line Integrate Pulse 1 Polarity=1
152 | Line Trigger Delay=0
153 | Line Trigger Duration=1
154 | Line Trigger Method=1
155 | Line Trigger Polarity=1
156 | LineScan Direction=0
157 | LineScan Direction Polarity=2
158 | Time Integrate Method=0
159 | Time Integrate Pulse 0 Delay=0
160 | Time Integrate Pulse 0 Duration=1
161 | Time Integrate Pulse 0 Polarity=1
162 | Time Integrate Pulse 1 Delay=0
163 | Time Integrate Pulse 1 Duration=1
164 | Time Integrate Pulse 1 Polarity=1
165 | WEN Polarity=0
166 | [Output]
167 | Output Format=1
168 | [Shared Control Signals]
169 | Camera Reset=-1
170 | Camera Trigger=-1
171 | External Trigger=-1
172 | Frame Integrate=-1
173 | Strobe=-1
174 | Time Integrate=-1
175 | [Signal Description]
176 | Bayer Alignment=0
177 | Bit Transfer Rate=0
178 | Channel=1
179 | Channels Order=1
180 | Coupling=0
181 | Field Order=4
182 | Frame=2
183 | Interface=2
184 | Data Lanes=0
185 | Pixel Depth=8
186 | Scan=2
187 | Signal=2
188 | Tap Output=4
189 | Tap 1 Direction=21
190 | Tap 2 Direction=21
191 | Tap 3 Direction=21
192 | Tap 4 Direction=21
193 | Tap 5 Direction=21
194 | Tap 6 Direction=21
195 | Tap 7 Direction=21
196 | Tap 8 Direction=21
197 | Tap 9 Direction=21
198 | Tap 10 Direction=21
199 | Tap 11 Direction=21
200 | Tap 12 Direction=21
201 | Tap 13 Direction=21
202 | Tap 14 Direction=21
203 | Tap 15 Direction=21
204 | Tap 16 Direction=21
205 | Taps=8
206 | Video=1
207 | Video Standard=1
208 | Video Level Minimum=0
209 | Video Level Maximum=0
210 | [Signal Timings]
211 | Horizontal Active=1024
212 | Horizontal Back Invalid=0
213 | Horizontal Back Porch=0
214 | Horizontal Front Invalid=0
215 | Horizontal Front Porch=0
216 | Horizontal Sync=8
217 | Vertical Active=480
218 | Vertical Back Invalid=0
219 | Vertical Back Porch=0
220 | Vertical Front Invalid=0
221 | Vertical Front Porch=0
222 | Vertical Sync=1
223 | [Pixel Clock]
224 | Pixel Clock Frequency 1:1=20000000
225 | Pixel Clock Detection=4
226 | Pixel Clock Frequency External=20000000
227 | Pixel Clock Frequency Internal=20000000
228 | Pixel Clock Source=2
229 | [Synchronization Signals]
230 | Horizontal Sync Polarity=1
231 | Synchronization Source=4
232 | Vertical Sync Polarity=1
233 | [Connector Description]
234 | Camera Link Configuration=0x4
235 | CX4 Configuration=0x0
236 | CLHS Configuration=0x0
237 | Timeslot=0x1
238 | Exposure Input=0x0
239 | HD Input=0x0
240 | Line Integrate Input=0x1020001
241 | Line Trigger Input=0x0
242 | Linescan Direction Input=0x0
243 | Pixel Clock Output=0x0
244 | Reset/Trigger Input=0x0
245 | VD Input=0x0
246 | WEN Output=0x0
247 | [Custom Camera IO Control Signals]
248 | Max Control=0
249 | [Serial Port]
250 | Baud Rate=0x40
251 | Data Bits=0x10
252 | Flow Control=0x1
253 | Parity=0x1
254 | Stop Bits=0x1
255 | Initialization String=
256 |
--------------------------------------------------------------------------------
/DeVision/system/UserManageL.accdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeVision/system/UserManageL.accdb
--------------------------------------------------------------------------------
/DeVision/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
4 |
5 | // 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
6 | // 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/DeVision/wcharUtil.cpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // wcharUtil.cpp
3 | // =============
4 | // conversion utility between multi-byte char and wide char
5 | //
6 | // AUTHOR: Song Ho Ahn (song.ahn@gmail.com)
7 | // CREATED: 2006-07-14
8 | // UPDATED: 2016-07-21
9 | ///////////////////////////////////////////////////////////////////////////////
10 |
11 | #pragma warning(disable : 4996)
12 | #include "stdafx.h"
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include "wcharUtil.h"
19 | using std::stringstream;
20 | using std::wstringstream;
21 | using std::string;
22 | using std::wstring;
23 |
24 | // global variables
25 | const int WCHAR_MAX_COUNT = 16; // max number of string buffers
26 | const int WCHAR_MAX_LENGTH = 2048; // max string length per buffer
27 | static wchar_t wchar_wideStr[WCHAR_MAX_COUNT][WCHAR_MAX_LENGTH];// circular buffer for wchar_t*
28 | static char wchar_str[WCHAR_MAX_COUNT][WCHAR_MAX_LENGTH]; // circular buffer for char*
29 | static int wchar_indexWchar = 0; // current index of circular buffer
30 | static int wchar_indexChar = 0; // current index of circular buffer
31 |
32 |
33 | ///////////////////////////////////////////////////////////////////////////////
34 | // convert char* string to wchar_t* string
35 | ///////////////////////////////////////////////////////////////////////////////
36 | const wchar_t* toWchar(const char *src)
37 | {
38 | wchar_indexWchar = (++wchar_indexWchar) % WCHAR_MAX_COUNT; // circulate index
39 |
40 | mbstowcs(wchar_wideStr[wchar_indexWchar], src, WCHAR_MAX_LENGTH); // copy string as wide char
41 | wchar_wideStr[wchar_indexWchar][WCHAR_MAX_LENGTH-1] = L'\0'; // in case when source exceeded max length
42 |
43 | return wchar_wideStr[wchar_indexWchar]; // return string as wide char
44 | }
45 |
46 |
47 |
48 | ///////////////////////////////////////////////////////////////////////////////
49 | // convert a number to wchar_t* string
50 | ///////////////////////////////////////////////////////////////////////////////
51 | const wchar_t* toWchar(double number, int precision)
52 | {
53 | wchar_indexWchar = (++wchar_indexWchar) % WCHAR_MAX_COUNT; // circulate index
54 |
55 | // convert a number to string
56 | wstring wstr;
57 | wstringstream wss;
58 | if(precision >= 0)
59 | wss << std::fixed << std::setprecision(precision);
60 |
61 | wss << number;
62 | wstr = wss.str();
63 |
64 | wcscpy(wchar_wideStr[wchar_indexWchar], wstr.c_str()); // copy it to circular buffer
65 |
66 | // unset floating format
67 | wss << std::resetiosflags(std::ios_base::fixed | std::ios_base::floatfield);
68 |
69 | return wchar_wideStr[wchar_indexWchar]; // return string as wide char
70 | }
71 | const wchar_t* toWchar(float number, int precision)
72 | {
73 | return toWchar((double)number, precision);
74 | }
75 | const wchar_t* toWchar(long number)
76 | {
77 | wchar_indexWchar = (++wchar_indexWchar) % WCHAR_MAX_COUNT; // circulate index
78 |
79 | // convert a number to string
80 | wstring wstr;
81 | wstringstream wss;
82 | wss << number;
83 | wstr = wss.str();
84 |
85 | wcscpy(wchar_wideStr[wchar_indexWchar], wstr.c_str()); // copy it to circular buffer
86 |
87 | return wchar_wideStr[wchar_indexWchar]; // return string as wide char
88 | }
89 | const wchar_t* toWchar(int number)
90 | {
91 | return toWchar((long)number);
92 | }
93 |
94 |
95 |
96 | ///////////////////////////////////////////////////////////////////////////////
97 | // convert wchar_t* string to char* string
98 | ///////////////////////////////////////////////////////////////////////////////
99 | const char* toChar(const wchar_t* src)
100 | {
101 | wchar_indexChar = (++wchar_indexChar) % WCHAR_MAX_COUNT; // circulate index
102 |
103 | wcstombs(wchar_str[wchar_indexChar], src, WCHAR_MAX_LENGTH);// copy string as char
104 | wchar_str[wchar_indexChar][WCHAR_MAX_LENGTH-1] = '\0'; // in case when source exceeded max length
105 |
106 | return wchar_str[wchar_indexChar]; // return string as char
107 | }
108 |
109 |
110 |
111 | ///////////////////////////////////////////////////////////////////////////////
112 | // convert a number to char* string
113 | ///////////////////////////////////////////////////////////////////////////////
114 | const char* toChar(double number, int precision)
115 | {
116 | wchar_indexChar = (++wchar_indexChar) % WCHAR_MAX_COUNT; // circulate index
117 |
118 | // convert a number to string
119 | string s;
120 | stringstream ss;
121 | if(precision >= 0)
122 | ss << std::fixed << std::setprecision(precision);
123 |
124 | ss << number;
125 | s = ss.str();
126 |
127 | strcpy(wchar_str[wchar_indexChar], s.c_str()); // copy to circular buffer
128 |
129 | // unset floating format
130 | ss << std::resetiosflags(std::ios_base::fixed | std::ios_base::floatfield);
131 |
132 | return wchar_str[wchar_indexChar]; // return string as char
133 | }
134 | const char* toChar(float number, int precision)
135 | {
136 | return toChar((double)number, precision);
137 | }
138 | const char* toChar(long number)
139 | {
140 | wchar_indexChar = (++wchar_indexChar) % WCHAR_MAX_COUNT; // circulate index
141 |
142 | // convert a number to string
143 | string s;
144 | stringstream ss;
145 | ss << number;
146 | s = ss.str();
147 |
148 | strcpy(wchar_str[wchar_indexChar], s.c_str()); // copy to circular buffer
149 |
150 | return wchar_str[wchar_indexChar]; // return string as char
151 | }
152 | const char* toChar(int number)
153 | {
154 | return toChar((long)number);
155 | }
156 |
--------------------------------------------------------------------------------
/DeVision/wcharUtil.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // wcharUtil.h
3 | // ===========
4 | // conversion utility between multi-byte char and wide char
5 | // It also converts any number to char or wchar_t format. For example,
6 | // toWchar(1) converts the number 1 to a wchar_t string, L"1".
7 | //
8 | // AUTHOR: Song Ho Ahn (song.ahn@gmail.com)
9 | // CREATED: 2006-07-14
10 | // UPDATED: 2016-07-21
11 | ///////////////////////////////////////////////////////////////////////////////
12 |
13 | #ifndef WCHAR_UTIL_H
14 | #define WCHAR_UTIL_H
15 |
16 | #pragma warning(disable : 4996)
17 |
18 | const wchar_t* toWchar(const char *str); // convert char* to wchar_t*
19 | const wchar_t* toWchar(float number, int precision=-1); // convert float to wchar_t*
20 | const wchar_t* toWchar(double number, int precision=-1);// convert double float to wchar_t*
21 | const wchar_t* toWchar(int number); // convert integer to wchar_t*
22 | const wchar_t* toWchar(long number); // convert long integer to wchar_t*
23 |
24 | const char* toChar(const wchar_t *str); // convert wchar_t* to char*
25 | const char* toChar(float number, int precision=-1); // convert float to char*
26 | const char* toChar(double number, int precision=-1); // convert double to char*
27 | const char* toChar(int number); // convert integer to char*
28 | const char* toChar(long number); // convert long integer to char*
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/DeffectRegisitFile.reg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/DeffectRegisitFile.reg
--------------------------------------------------------------------------------
/FindCamera/ExampleUtils.h:
--------------------------------------------------------------------------------
1 |
2 | #include "stdio.h"
3 | #include "conio.h"
4 | #include "sapclassbasic.h"
5 | #include
6 | #include
7 |
8 | // Static Variables
9 | #define GAMMA_FACTOR 10000
10 | #define MAX_CONFIG_FILES 36 // 10 numbers + 26 lowercase letters
11 | #define STRING_LENGTH 256
12 | static char configFileNames[MAX_CONFIG_FILES][MAX_PATH] = {0};
13 |
14 | #define GVSP_PIX_BAYRG8 (0x01000000 | 0x00080000 | 0x0009)
15 |
16 | #define CAMERA_LINK_SERVER_NAME_PREFIX "CameraLink_"
17 |
18 | #ifndef __clang__
19 | inline double round(double x)
20 | {
21 | return (x > 0.0 ? x + 0.5 : x - 0.5);
22 | }
23 | #endif
24 |
25 | #ifndef min
26 | #define min(a, b) (((a) < (b)) ? (a) : (b))
27 | #endif
28 |
29 | // Functions defined to be used in Grab Examples
30 | BOOL GetOptionsFromQuestions(char *acqServerName, UINT32 *pAcqDeviceIndex, char *configFileName);
31 | BOOL GetCorAcqOptionsFromQuestions(char *acqServerName, UINT32 *pAcqDeviceIndex, char *configFileName);
32 | BOOL GetCorAcqDeviceOptionsFromQuestions(char *acqServerName, UINT32 *pAcqDeviceIndex, BOOL showGigEOnly = FALSE);
33 | BOOL GetCorAcquisitionOptionsFromQuestions(char *acqServerName, UINT32 *pAcqDeviceIndex, char *configFileName);
34 |
35 | // Functions defined to be used in LUT Examples
36 | BOOL IsMonoBuffer(SapBuffer* Buffers);
37 | SapData SetDataValue(SapBuffer* Buffers, DWORD *pPrmIndex);
38 | BOOL GetLUTOptionsFromQuestions(SapBuffer* Buffers, SapLut* m_pLut, char *chAcqLutName);
39 | BOOL GetLoadLUTFiles(SapLut* Lut, std::vector v_list, BOOL* bLutLoaded);
40 | std::vector GetLUTFilesSaved(const char* Dossier, std::vector pList, BOOL bPrint);
41 |
42 | #ifndef SAP_CAMERA_SDK
43 | BOOL GetLoadDynamicLUTFiles(SapDynamicLut* DynamicLut, int lutIndex, std::vector v_list, BOOL* bLutLoaded);
44 | #endif
45 |
46 | // Functions defined to be used in the 3D Examples
47 | #ifndef SAP_CAMERA_SDK
48 | const int PROFILE_WINDOW_HEIGHT = 1024; //Should fit all displays resolutions
49 | const int CLUSTERS_DIVISOR = USHRT_MAX / (PROFILE_WINDOW_HEIGHT - 1) + 1; //To clusterize the range from 0-65535 to 0-ProfileWindowHeight
50 |
51 | enum PIXEL_FORMAT { C, CR, AC, ACRW };
52 | enum BUFFER_LAYOUT { Profile, Range};
53 |
54 | bool GetParametersFrom3DBuffer(SapBuffer *Buffer, int* Invalid_Flag_C, double* Invalid_Value_C,
55 | double* Scale_C, double* Offset_C, BUFFER_LAYOUT* Buffer_Layout);
56 | void DisplayRange(SapView * View, SapBuffer * Buffer);
57 | void DisplayProfile(SapView * View, SapBuffer * Buffer);
58 | void ProcessingRange(SapBuffer * Buffer, int Invalid_Flag_C, double Invalid_Value_C,
59 | double Scale_C, double Offset_C, int * Pixel_Mean,int * World_Mean);
60 | void ProcessingProfile(SapBuffer * Buffer, int Invalid_Flag_C, double Invalid_Value_C,
61 | double Scale_C, double Offset_C, int * Pixel_Mean,int * World_Mean);
62 | bool GetSelectionFromConsoleCR(int* pIndex_DisplayedComponent);
63 | bool GetSelectionFromConsoleAC(int* pIndex_DisplayedComponent);
64 | bool GetSelectionFromConsoleACRW(int* pIndex_DisplayedComponent);
65 | #endif
66 |
67 | // General Functions
68 | int GetKeyCharIndex(char key);
69 | BOOL GetFileOptions( int argc, char *argv[], char *fileDirectory, const char *fileList[], int fileListSize, char *filename, int size);
70 | BOOL AddSaperaPath(char *filename, int size);
71 | void FixFileName(char *filename, int size);
72 |
73 |
--------------------------------------------------------------------------------
/FindCamera/FindCamera.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 15.0
23 | {C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}
24 | FindCamera
25 | 10.0.17763.0
26 |
27 |
28 |
29 | Application
30 | true
31 | v141
32 | MultiByte
33 |
34 |
35 | Application
36 | false
37 | v141
38 | true
39 | MultiByte
40 |
41 |
42 | Application
43 | true
44 | v141
45 | MultiByte
46 |
47 |
48 | Application
49 | false
50 | v141
51 | true
52 | MultiByte
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | Level3
77 | MaxSpeed
78 | true
79 | true
80 | true
81 | true
82 |
83 |
84 | Console
85 | true
86 | true
87 |
88 |
89 |
90 |
91 | Level3
92 | Disabled
93 | true
94 | true
95 |
96 |
97 | Console
98 |
99 |
100 |
101 |
102 | Level3
103 | Disabled
104 | true
105 | true
106 |
107 |
108 | Console
109 |
110 |
111 |
112 |
113 | Level3
114 | MaxSpeed
115 | true
116 | true
117 | true
118 | true
119 |
120 |
121 | Console
122 | true
123 | true
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/FindCamera/FindCamera.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 | 源文件
23 |
24 |
25 |
26 |
27 | 头文件
28 |
29 |
30 |
--------------------------------------------------------------------------------
/FindCamera/SaperaLot_x64_release.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | C:\Program Files\Teledyne DALSA\Sapera\Include;C:\Program Files\Teledyne DALSA\Sapera\Classes\Basic;%(AdditionalIncludeDirectories)
9 |
10 |
11 | C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64;%(AdditionalLibraryDirectories)
12 | SapClassBasic.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/HdevelopFiles/algorithm0606.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | dev_update_off ()
7 | dev_close_window ()
8 | read_image (Image, 'E:/DeVisionProject/OneCamera_0417/reference_image1.bmp')
9 | get_image_size (Image, Width, Height)
10 | dev_open_window (0, 0, 0.06 * Width, 0.06 * Height, 'black', WindowHandle)
11 | set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
12 | dev_set_draw ('margin')
13 | dev_set_line_width (3)
14 | dev_set_color ('red')
15 |
16 | *median_image (Image, ImageMedian, 'square', 3, 'mirrored')
17 | gen_image_const (ImageAverage, 'byte', Width, Height)
18 | gen_image_const (ImageDeviation, 'byte', Width, Height)
19 |
20 | for column := 0 to Width - 1 by 1
21 | gen_rectangle1 (Rectangle, 0, column, 8192, column + 1)
22 | intensity (Rectangle, Image, Mean, Deviation)
23 | *标准差
24 | tuple_sqrt (Deviation, Sqrt)
25 | overpaint_region (ImageAverage, Rectangle, Mean, 'fill')
26 | overpaint_region (ImageDeviation, Rectangle, min([ 5 * Sqrt,255]), 'fill')
27 | endfor
28 | stop()
29 |
30 | read_image (Image1, 'E:/DeVisionProject/OneCamera_0417/test1_1.bmp')
31 |
32 | *测试:手动AOP优化
33 | set_system ('parallelize_operators', 'true')
34 | get_system ('parallelize_operators', AOP)
35 | optimize_aop ('median_image', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
36 | optimize_aop ('sub_image', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
37 | optimize_aop ('add_image', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
38 | optimize_aop ('threshold', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
39 |
40 | count_seconds (Seconds1)
41 | for turn := 1 to 100 by 1
42 | *median_image (Image1, ImageMedian1, 'square', 3, 'mirrored')
43 |
44 | sub_image (Image1, ImageAverage, ImageSub1, 1, 0)
45 | sub_image (ImageAverage, Image1, ImageSub2, 1, 0)
46 | add_image (ImageSub1, ImageSub2, ImageResult, 0.5, 0)
47 | sub_image (ImageResult, ImageDeviation, ImageOut, 1, 0)
48 | threshold (ImageOut, Region, 1, 255)
49 | dilation_circle (Region, RegionDilation, 64)
50 | erosion_circle (RegionDilation, RegionErosion, 64)
51 |
52 | connection (RegionErosion, ConnectedRegions)
53 | select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 3, 65536)
54 | count_obj (SelectedRegions, Number)
55 |
56 | endfor
57 | count_seconds (Seconds2)
58 | ResultMessage := Seconds2 - Seconds1
59 | Color := 'forest green'
60 | disp_message (WindowHandle, ResultMessage, 'window', 12, 12, Color, 'true')
61 |
62 | stop()
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/HdevelopFiles/algorithm_GPU_0606.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | dev_update_off ()
7 | dev_close_window ()
8 | read_image (Image, 'E:/DeVisionProject/OneCamera_0417/reference_image1.bmp')
9 | get_image_size (Image, Width, Height)
10 | dev_open_window (0, 0, 0.06 * Width, 0.06 * Height, 'black', WindowHandle)
11 | set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
12 | dev_set_draw ('margin')
13 | dev_set_line_width (3)
14 | dev_set_color ('red')
15 |
16 | median_image (Image, ImageMedian, 'square', 3, 'mirrored')
17 | gen_image_const (ImageAverage, 'byte', Width, Height)
18 | gen_image_const (ImageDeviation, 'byte', Width, Height)
19 |
20 | for column := 0 to Width - 1 by 1
21 | gen_rectangle1 (Rectangle, 0, column, 8192, column + 1)
22 | intensity (Rectangle, ImageMedian, Mean, Deviation)
23 | *标准差
24 | tuple_sqrt (Deviation, Sqrt)
25 | overpaint_region (ImageAverage, Rectangle, Mean, 'fill')
26 | overpaint_region (ImageDeviation, Rectangle, min([ 5 * Sqrt,255]), 'fill')
27 | endfor
28 |
29 |
30 | read_image (Image1, 'E:/DeVisionProject/OneCamera_0417/test1_1.bmp')
31 |
32 | count_seconds (Seconds1)
33 |
34 |
35 | *测试3:GPU加速,支持GPU加速的算子Halcon19.11有82个
36 | *GPU加速是先从CPU中将数据拷贝到GPU上处理,处理完成后再将数据从GPU拷贝到CPU上。从CPU到GPU再从GPU到CPU是要花费时间的。
37 | *GPU加速一定会比正常的AOP运算速度快吗?不一定!结果取决于显卡的好坏.
38 | query_available_compute_devices(DeviceIdentifiers)
39 | DeviceHandle:=0
40 | for i:=0 to |DeviceIdentifiers|-1 by 1
41 | get_compute_device_info(DeviceIdentifiers[i], 'name', Nmae)
42 | if (Nmae == 'Intel(R) HD Graphics 630')//根据GPU名称打开GPU GeForce GTX 1050 Ti Intel(R) HD Graphics 630
43 | open_compute_device(DeviceIdentifiers[i], DeviceHandle)
44 | break
45 | endif
46 | endfor
47 |
48 | if(DeviceHandle#0)
49 | set_compute_device_param (DeviceHandle, 'asynchronous_execution', 'false')
50 | init_compute_device(DeviceHandle, 'median_image')
51 | *init_compute_device(DeviceHandle, 'sub_image')
52 | *init_compute_device(DeviceHandle, 'add_image')
53 | activate_compute_device(DeviceHandle)
54 | endif
55 |
56 | for turn := 1 to 100 by 1
57 | median_image (Image1, ImageMedian1, 'square', 3, 'mirrored')
58 |
59 | sub_image (ImageMedian1, ImageAverage, ImageSub1, 1, 0)
60 | sub_image (ImageAverage, ImageMedian1, ImageSub2, 1, 0)
61 | add_image (ImageSub1, ImageSub2, ImageResult, 0.5, 0)
62 | sub_image (ImageResult, ImageDeviation, ImageOut, 1, 0)
63 | threshold (ImageOut, Region, 1, 255)
64 | dilation_circle (Region, RegionDilation, 64)
65 | erosion_circle (RegionDilation, RegionErosion, 64)
66 |
67 | connection (RegionErosion, ConnectedRegions)
68 | select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 3, 65536)
69 | count_obj (SelectedRegions, Number)
70 |
71 |
72 | endfor
73 | count_seconds (Seconds2)
74 | ResultMessage := Seconds2 - Seconds1
75 | Color := 'forest green'
76 | disp_message (WindowHandle, ResultMessage, 'window', 12, 12, Color, 'true')
77 | deactivate_compute_device (DeviceHandle)
78 |
79 | stop()
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/HdevelopFiles/gpu_test.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | query_available_compute_devices(DeviceIdentifiers)
7 | DeviceHandle:=0
8 | for i:=0 to |DeviceIdentifiers|-1 by 1
9 | get_compute_device_info(DeviceIdentifiers[i], 'name', Nmae)
10 | if (Nmae == 'Intel(R) HD Graphics 630')//根据GPU名称打开GPU GeForce GTX 1050 Ti Intel(R) HD Graphics 630
11 | open_compute_device(DeviceIdentifiers[i], DeviceHandle)
12 | break
13 | endif
14 | endfor
15 |
16 | if(DeviceHandle#0)
17 | set_compute_device_param (DeviceHandle, 'asynchronous_execution', 'false')
18 | init_compute_device(DeviceHandle, 'median_image')
19 | *init_compute_device(DeviceHandle, 'sub_image')
20 | *init_compute_device(DeviceHandle, 'add_image')
21 | activate_compute_device(DeviceHandle)
22 | endif
23 |
24 | deactivate_compute_device (DeviceHandle)
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/HdevelopFiles/special_change.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | read_image (Image, 'C:/DeVisionProject/sample0319/r2.bmp')
7 | get_image_size (Image, Width, Height)
8 |
9 | * for i:=2000 to 2005 by 1
10 | * for j:=2000 to 2005 by 1
11 | * set_grayval (Image, i, j, 225)
12 | * endfor
13 | * endfor
14 |
15 | for i:=4000 to 4005 by 1
16 | for j:=4000 to 4005 by 1
17 | set_grayval (Image, i, j, 225)
18 | endfor
19 | endfor
20 |
21 | * for i:=6000 to 6005 by 1
22 | * for j:=6000 to 6005 by 1
23 | * set_grayval (Image, i, j, 225)
24 | * endfor
25 | * endfor
26 |
27 | * for i:=8000 to 8005 by 1
28 | * for j:=7000 to 7005 by 1
29 | * set_grayval (Image, i, j, 225)
30 | * endfor
31 | * endfor
32 |
33 | * for ii:=4000 to 4005 by 1
34 | * for jj:=6000 to 6005 by 1
35 | * set_grayval (Image, ii, jj, 15)
36 | * endfor
37 | * endfor
38 |
39 | * copy_image (Image, DupImage)
40 |
41 | write_image (Image, 'bmp', 0, 'C:/DeVisionProject/sample0319/c2.bmp')
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/HdevelopFiles/stable_program_0228.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | dev_update_off()
7 | dev_close_window()
8 |
9 | *读取参考图像
10 | read_image (Image, 'E:/DeVisionProject/sample0118/reference_image.bmp')
11 | get_image_size (Image, Width, Height)
12 | median_image (Image, ImageMedian, 'circle', 1, 'mirrored')
13 |
14 | dev_open_window (0, 0, 0.06*Width, 0.06*Height, 'black', WindowHandle)
15 | set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
16 | dev_set_draw ('margin')
17 | dev_set_line_width (3)
18 | dev_set_color ('red')
19 |
20 | count_seconds (Seconds)
21 | *读取待检测图像
22 | read_image (Image1, 'E:/DeVisionProject/sample0118/037.bmp')
23 | median_image (Image1, ImageMedian1, 'circle', 1, 'mirrored')
24 | *参考图像减去待检测图像,结果取绝对值
25 | *可利用放大倍数设置检测的精度和等级
26 | abs_diff_image (ImageMedian1, ImageMedian, ImageAbsDiff, 5)
27 | median_image (ImageAbsDiff, ImageMedian_diff, 'square', 2, 'mirrored')
28 |
29 | *参考图像像素平均值
30 | get_domain (ImageMedian, Domain)
31 | intensity (Domain, ImageMedian, Mean, Deviation)
32 | *差值图像的像素最大值
33 | min_max_gray (Domain, ImageMedian_diff, 0, Min, Max, Range)
34 |
35 | * dev_display(Image1)
36 | count_seconds (Seconds)
37 | for rownum:=0 to 31 by 1
38 | for colnum:=0 to 31 by 1
39 | *重定义图像的定义域,分切图像
40 | gen_rectangle1 (Rectangle, rownum*256, colnum*256, (rownum+1)*256, (colnum+1)*256)
41 | *帧相减后的图像在缩减区域的像素平均值
42 | reduce_domain (ImageMedian_diff, Rectangle, ImageReduced)
43 | intensity (Rectangle, ImageReduced, Mean_small_abs_diff, Deviation1)
44 | between_mean := abs(Mean - Mean_small_abs_diff)
45 | *求区域内像素的最大最小值
46 | *reduce_domain (ImageAbsDiff, Rectangle, ImageReduced3)
47 | min_max_gray (Rectangle, ImageReduced, 25, Min1, Max1, Range1)
48 | *分切后的图像动态阈值化
49 | *threshold (ImageReduced, Region, 0.8*max([min([255,Mean * 1.2]), min([255,Mean_small_abs_diff * 1.2])]), 255)
50 | threshold (ImageReduced, Region, min([Mean*0.5, 255]), 255)
51 | *连接区域
52 | connection (Region, ConnectedRegions)
53 | *选择ROI
54 | select_shape (ConnectedRegions, SelectedRegions, 'contlength', 'and', 5, 999999)
55 | * dev_set_color ('red')
56 | * dev_display(Image1)
57 | * dev_display(Rectangle)
58 | * dev_display(SelectedRegions)
59 | * stop()
60 | *对单张小图进行处理
61 | *计算ROI数量
62 | count_obj (SelectedRegions, Number)
63 | if(Number)
64 | total_Row := 0
65 | total_Column := 0
66 | for i:=1 to Number by 1
67 | select_obj (SelectedRegions, ObjectSelected, i)
68 | smallest_circle (ObjectSelected, Row, Column, Radius)
69 | *区域内有多个瑕疵则需要对位置进行平均
70 | total_Row := total_Row + Row
71 | total_Column := total_Column + Column
72 | endfor
73 | average_Row := total_Row / Number
74 | average_Column := total_Column / Number
75 | *缺陷在大图中的实际坐标
76 | if(average_Row < 127)
77 | average_Row := 127
78 | elseif(average_Row > 8065)
79 | average_Row := 8065
80 | endif
81 | if(average_Column < 127)
82 | average_Column := 127
83 | elseif(average_Column > 8065)
84 | average_Column := 8065
85 | endif
86 | *保存瑕疵区域图片
87 | gen_rectangle1 (Rectangle1, average_Row - 127, average_Column - 127, average_Row + 128, average_Column + 128)
88 | reduce_domain (Image1, Rectangle1, ImageReduced1)
89 | crop_domain (ImageReduced1, ImagePart)
90 | par_start<ThreadID> : write_image (ImagePart, 'bmp', 0, 'E:/DeVisionProject/sample0118/deffect_image/X' + average_Column$'02' + '_Y' + average_Row$'02')
91 | * dev_set_color ('blue')
92 | * dev_display(Rectangle1)
93 | * dev_set_color('red')
94 | * dev_display(SelectedRegions)
95 | * stop()
96 | else
97 | ResultMessage :='OK'
98 | Color := 'forest green'
99 | *disp_message (WindowHandle, ResultMessage, 'window', 12, 12, Color, 'true')
100 | endif
101 | endfor
102 | endfor
103 |
104 | count_seconds (Seconds1)
105 | Time := Seconds1 -Seconds
106 | disp_message (WindowHandle, Time, 'window', 12, 12, 'red', 'true')
107 | stop()
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/HdevelopFiles/stable_program_0303.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | dev_update_off()
7 | dev_close_window()
8 |
9 | *读取参考图像
10 | read_image (Image_ref, 'C:/DeVisionProject/sample0118/reference_image.bmp')
11 | get_image_size (Image_ref, Width_ref, Height_ref)
12 | median_image (Image_ref, ImageMedian_ref, 'circle', 1, 'mirrored')
13 |
14 | dev_open_window (0, 0, 0.06*Width_ref, 0.06*Height_ref, 'black', WindowHandle)
15 | set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
16 | dev_set_draw ('margin')
17 | dev_set_line_width (3)
18 | dev_set_color ('red')
19 |
20 | count_seconds (Seconds)
21 | *读取待检测图像
22 | read_image (Image_def, 'C:/DeVisionProject/sample0118/037a.bmp')
23 | threshold (Image_def, Region_defth, 1, 255)
24 | connection (Region_defth, ConnectedRegions_defth)
25 | smallest_rectangle1 (ConnectedRegions_defth, Row_origin_def, Column_origin_def, Row_end_def, Column_end_def)
26 | reduce_domain (Image_def, ConnectedRegions_defth, ImageReduced_def)
27 | crop_domain (ImageReduced_def, ImagePart_def)
28 | median_image (ImagePart_def, ImageMedian_def, 'circle', 1, 'mirrored')
29 | get_image_size (ImageMedian_def, Width_def, Height_def)
30 | *判断图像是否有黑边
31 | if( Width_ref != Width_def or Height_ref != Height_def)
32 | reduce_domain (ImageMedian_ref, ConnectedRegions_defth, ImageReduced_ref)
33 | crop_domain (ImageReduced_ref, ImagePart_ref)
34 | abs_diff_image (ImageMedian_def, ImagePart_ref, ImageAbsDiff, 5)
35 | median_image (ImageAbsDiff, ImageMedian_absdiff, 'square', 2, 'mirrored')
36 | else
37 | *参考图像减去待检测图像,结果取绝对值
38 | *可利用放大倍数设置检测的精度和等级
39 | abs_diff_image (ImageMedian_def, ImageMedian_ref, ImageAbsDiff, 5)
40 | median_image (ImageAbsDiff, ImageMedian_absdiff, 'square', 2, 'mirrored')
41 | endif
42 |
43 | *参考图像像素平均值
44 | get_domain (ImageMedian_ref, Domain_ref)
45 | intensity (Domain_ref, ImageMedian_ref, Mean_ref, Deviation_ref)
46 | *差值图像的像素最大值
47 | min_max_gray (Domain_ref, ImageMedian_absdiff, 0, Min_ref, Max_ref, Range_ref)
48 |
49 | * dev_display(Image1)
50 | count_seconds (Seconds)
51 |
52 | row_scale := Height_def / 256
53 | if(Height_def % 256 != 0)
54 | row_scale := row_scale + 1
55 | endif
56 | column_scale := Width_def / 256
57 | if(Width_def % 256 != 0)
58 | column_scale := column_scale + 1
59 | endif
60 |
61 | for rownum:=0 to row_scale-1 by 1
62 | for colnum:=0 to column_scale-1 by 1
63 | *重定义图像的定义域,分切图像
64 | gen_rectangle1 (Rectangle, rownum*256 + Row_origin_def, colnum*256 + Column_origin_def, (rownum+1)*256+ Row_origin_def, (colnum+1)*256 + Column_origin_def)
65 | reduce_domain (ImageMedian_absdiff, Rectangle, ImageReduced_defsmall)
66 | *帧相减后的图像在缩减区域的像素平均值
67 | intensity (Rectangle, ImageReduced_defsmall, Mean_small_abs_diff, Deviation_small_abs_diff)
68 | between_mean := abs(Mean_ref - Mean_small_abs_diff)
69 | *求区域内像素的最大最小值
70 | *reduce_domain (ImageAbsDiff, Rectangle, ImageReduced3)
71 | min_max_gray (Rectangle, ImageReduced_defsmall, 25, Min_defsmall, Max_defsmall, Range_defsmall)
72 | *分切后的图像动态阈值化
73 | *threshold (ImageReduced_defsmall, Region, 0.8*max([min([255,Mean * 1.2]), min([255,Mean_small_abs_diff * 1.2])]), 255)
74 | threshold (ImageReduced_defsmall, Region, min([Mean_ref*0.5, 255]), 255)
75 |
76 | *连接区域
77 | connection (Region, ConnectedRegions)
78 | *选择ROI
79 | select_shape (ConnectedRegions, SelectedRegions, 'contlength', 'and', 5, 999999)
80 | * dev_set_color ('red')
81 | * dev_display(Image_def)
82 | * dev_display(Rectangle)
83 | * dev_display(SelectedRegions)
84 | * stop()
85 | *对单张小图进行处理
86 | *计算ROI数量
87 | count_obj (SelectedRegions, Number)
88 | if(Number)
89 | total_Row := 0
90 | total_Column := 0
91 | for i:=1 to Number by 1
92 | select_obj (SelectedRegions, ObjectSelected, i)
93 | smallest_circle (ObjectSelected, Row, Column, Radius)
94 | *区域内有多个瑕疵则需要对位置进行平均
95 | total_Row := total_Row + Row
96 | total_Column := total_Column + Column
97 | endfor
98 | average_Row := total_Row / Number
99 | average_Column := total_Column / Number
100 | *缺陷在大图中的实际坐标
101 | if(average_Row < 127)
102 | average_Row := 127
103 | elseif(average_Row > 8065)
104 | average_Row := 8065
105 | endif
106 | if(average_Column < 127)
107 | average_Column := 127
108 | elseif(average_Column > 8065)
109 | average_Column := 8065
110 | endif
111 | *保存瑕疵区域图片
112 | gen_rectangle1 (Rectangle1, average_Row - 127, average_Column - 127, average_Row + 128, average_Column + 128)
113 | reduce_domain (Image_def, Rectangle1, ImageReduced1)
114 | crop_domain (ImageReduced1, ImagePart)
115 | par_start<ThreadID> : write_image (ImagePart, 'bmp', 0, 'C:/DeVisionProject/sample0118/deffect_image/X' + average_Column$'02' + '_Y' + average_Row$'02')
116 | * dev_set_color ('blue')
117 | * dev_display(Rectangle1)
118 | * dev_set_color('red')
119 | * dev_display(SelectedRegions)
120 | * stop()
121 | else
122 | ResultMessage :='OK'
123 | Color := 'forest green'
124 | *disp_message (WindowHandle, ResultMessage, 'window', 12, 12, Color, 'true')
125 | endif
126 | endfor
127 | endfor
128 |
129 | count_seconds (Seconds1)
130 | Time := Seconds1 -Seconds
131 | disp_message (WindowHandle, Time, 'window', 12, 12, 'red', 'true')
132 | stop()
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/HdevelopFiles/stable_program_0320_multy_thread.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | dev_update_off()
7 | dev_close_window()
8 |
9 | *读取参考图像
10 | read_image (Image_ref, 'C:/DeVisionProject/sample0118/reference_image1.bmp')
11 | get_image_size (Image_ref, Width_ref, Height_ref)
12 | median_image (Image_ref, ImageMedian_ref, 'circle', 1, 'mirrored')
13 |
14 | dev_open_window (0, 0, 0.06*Width_ref, 0.06*Height_ref, 'black', WindowHandle)
15 | set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
16 | dev_set_draw ('margin')
17 | dev_set_line_width (3)
18 | dev_set_color ('red')
19 |
20 | count_seconds (Seconds)
21 | *读取待检测图像
22 | read_image (Image_def, 'C:/DeVisionProject/sample0118/014.bmp')
23 | threshold (Image_def, Region_defth, 1, 255)
24 | connection (Region_defth, ConnectedRegions_defth)
25 | smallest_rectangle1 (ConnectedRegions_defth, Row_origin_def, Column_origin_def, Row_end_def, Column_end_def)
26 | reduce_domain (Image_def, ConnectedRegions_defth, ImageReduced_def)
27 | crop_domain (ImageReduced_def, ImagePart_def)
28 | median_image (ImagePart_def, ImageMedian_def, 'circle', 1, 'mirrored')
29 | get_image_size (ImageMedian_def, Width_def, Height_def)
30 | *判断图像是否有黑边
31 | if( Width_ref != Width_def or Height_ref != Height_def)
32 | reduce_domain (ImageMedian_ref, ConnectedRegions_defth, ImageReduced_ref)
33 | crop_domain (ImageReduced_ref, ImagePart_ref)
34 | abs_diff_image (ImageMedian_def, ImagePart_ref, ImageAbsDiff, 5)
35 | median_image (ImageAbsDiff, ImageMedian_absdiff, 'square', 2, 'mirrored')
36 | else
37 | *参考图像减去待检测图像,结果取绝对值
38 | *可利用放大倍数设置检测的精度和等级
39 | abs_diff_image (ImageMedian_def, ImageMedian_ref, ImageAbsDiff, 5)
40 | median_image (ImageAbsDiff, ImageMedian_absdiff, 'square', 2, 'mirrored')
41 | endif
42 |
43 | *参考图像像素平均值
44 | get_domain (ImageMedian_ref, Domain_ref)
45 | intensity (Domain_ref, ImageMedian_ref, Mean_ref, Deviation_ref)
46 | *差值图像的像素最大值
47 | min_max_gray (Domain_ref, ImageMedian_absdiff, 0, Min_ref, Max_ref, Range_ref)
48 |
49 | * dev_display(Image1)
50 | count_seconds (Seconds)
51 |
52 | row_scale := Height_def / 256
53 | if(Height_def % 256 != 0)
54 | row_scale := row_scale + 1
55 | endif
56 | column_scale := Width_def / 256
57 | if(Width_def % 256 != 0)
58 | column_scale := column_scale + 1
59 | endif
60 |
61 | for rownum:=0 to row_scale-1 by 1
62 | for colnum:=0 to column_scale-1 by 1
63 | *重定义图像的定义域,分切图像
64 | gen_rectangle1 (Rectangle, rownum*256 + Row_origin_def, colnum*256 + Column_origin_def, (rownum+1)*256+ Row_origin_def, (colnum+1)*256 + Column_origin_def)
65 | reduce_domain (ImageMedian_absdiff, Rectangle, ImageReduced_defsmall)
66 | *帧相减后的图像在缩减区域的像素平均值
67 | intensity (Rectangle, ImageReduced_defsmall, Mean_small_abs_diff, Deviation_small_abs_diff)
68 | between_mean := abs(Mean_ref - Mean_small_abs_diff)
69 | *求区域内像素的最大最小值
70 | *reduce_domain (ImageAbsDiff, Rectangle, ImageReduced3)
71 | min_max_gray (Rectangle, ImageReduced_defsmall, 25, Min_defsmall, Max_defsmall, Range_defsmall)
72 | *分切后的图像动态阈值化
73 | *threshold (ImageReduced_defsmall, Region, 0.8*max([min([255,Mean * 1.2]), min([255,Mean_small_abs_diff * 1.2])]), 255)
74 | threshold (ImageReduced_defsmall, Region, min([Mean_ref*0.5, 255]), 255)
75 |
76 | *连接区域
77 | connection (Region, ConnectedRegions)
78 | *选择ROI
79 | select_shape (ConnectedRegions, SelectedRegions, 'contlength', 'and', 5, 999999)
80 | * dev_set_color ('red')
81 | * dev_display(Image_def)
82 | * dev_display(Rectangle)
83 | * dev_display(SelectedRegions)
84 | * stop()
85 | *对单张小图进行处理
86 | *计算ROI数量
87 | count_obj (SelectedRegions, Number)
88 | if(Number)
89 | total_Row := 0
90 | total_Column := 0
91 | for i:=1 to Number by 1
92 | select_obj (SelectedRegions, ObjectSelected, i)
93 | smallest_circle (ObjectSelected, Row, Column, Radius)
94 | *区域内有多个瑕疵则需要对位置进行平均
95 | total_Row := total_Row + Row
96 | total_Column := total_Column + Column
97 | endfor
98 | average_Row := total_Row / Number
99 | average_Column := total_Column / Number
100 | *缺陷在大图中的实际坐标
101 | if(average_Row < 127)
102 | average_Row := 127
103 | elseif(average_Row > 8065)
104 | average_Row := 8065
105 | endif
106 | if(average_Column < 127)
107 | average_Column := 127
108 | elseif(average_Column > 8065)
109 | average_Column := 8065
110 | endif
111 | *保存瑕疵区域图片
112 | gen_rectangle1 (Rectangle1, average_Row - 127, average_Column - 127, average_Row + 128, average_Column + 128)
113 | reduce_domain (Image_def, Rectangle1, ImageReduced1)
114 | crop_domain (ImageReduced1, ImagePart)
115 | par_start<ThreadID> : write_image (ImagePart, 'bmp', 0, 'C:/DeVisionProject/sample0118/deffect_image/X' + average_Column$'02' + '_Y' + average_Row$'02')
116 | * dev_set_color ('blue')
117 | * dev_display(Rectangle1)
118 | * dev_set_color('red')
119 | * dev_display(SelectedRegions)
120 | * stop()
121 | else
122 | ResultMessage :='OK'
123 | Color := 'forest green'
124 | *disp_message (WindowHandle, ResultMessage, 'window', 12, 12, Color, 'true')
125 | endif
126 | endfor
127 | endfor
128 |
129 | count_seconds (Seconds1)
130 | Time := Seconds1 -Seconds
131 | disp_message (WindowHandle, Time, 'window', 12, 12, 'red', 'true')
132 | stop()
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/HdevelopFiles/stable_program_Cplusplus_0228.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | *读取参考图像
7 | read_image (Image, 'E:/DeVisionProject/sample0118/refererence_image.bmp')
8 | get_image_size (Image, Width, Height)
9 | median_image (Image, ImageMedian, 'circle', 1, 'mirrored')
10 | *读取待检测图像
11 | read_image (Image1, 'E:/DeVisionProject/sample0118_2/045.bmp')
12 | median_image (Image1, ImageMedian1, 'circle', 1, 'mirrored')
13 | *参考图像减去待检测图像,结果取绝对值
14 | *可利用放大倍数设置检测的精度和等级
15 | abs_diff_image (ImageMedian1, ImageMedian, ImageAbsDiff, 5)
16 | median_image (ImageAbsDiff, ImageMedian_diff, 'square', 2, 'mirrored')
17 | *参考图像像素平均值
18 | get_domain (ImageMedian, Domain)
19 | intensity (Domain, ImageMedian, Mean, Deviation)
20 | *差值图像的像素最大值
21 | min_max_gray (Domain, ImageMedian_diff, 0, Min, Max, Range)
22 |
23 | for rownum:=0 to 31 by 1
24 | for colnum:=0 to 31 by 1
25 | *重定义图像的定义域,分切图像
26 | gen_rectangle1 (Rectangle, rownum*256, colnum*256, (rownum+1)*256, (colnum+1)*256)
27 | *帧相减后的图像在缩减区域的像素平均值
28 | reduce_domain (ImageMedian_diff, Rectangle, ImageReduced)
29 | intensity (Rectangle, ImageReduced, Mean_small_abs_diff, Deviation1)
30 | between_mean := abs(Mean - Mean_small_abs_diff)
31 | *求区域内像素的最大最小值
32 | min_max_gray (Rectangle, ImageReduced, 25, Min1, Max1, Range1)
33 | *分切后的图像动态阈值化
34 | threshold (ImageReduced, Region, min([Mean*0.5, 255]), 255)
35 | *连接区域
36 | connection (Region, ConnectedRegions)
37 | *选择ROI
38 | select_shape (ConnectedRegions, SelectedRegions, 'contlength', 'and', 5, 999999)
39 |
40 | *对单张小图进行处理
41 | *计算ROI数量
42 | count_obj (SelectedRegions, Number)
43 | if(Number)
44 | total_Row := 0
45 | total_Column := 0
46 | for i:=1 to Number by 1
47 | select_obj (SelectedRegions, ObjectSelected, i)
48 | smallest_circle (ObjectSelected, Row, Column, Radius)
49 | *区域内有多个瑕疵则需要对位置进行平均
50 | total_Row := total_Row + Row
51 | total_Column := total_Column + Column
52 | endfor
53 | average_Row := total_Row / Number
54 | average_Column := total_Column / Number
55 | *缺陷在大图中的实际坐标
56 | if(average_Row < 127)
57 | average_Row := 127
58 | elseif(average_Row > 8065)
59 | average_Row := 8065
60 | endif
61 | if(average_Column < 127)
62 | average_Column := 127
63 | elseif(average_Column > 8065)
64 | average_Column := 8065
65 | endif
66 | *保存瑕疵区域图片
67 | gen_rectangle1 (Rectangle1, average_Row - 127, average_Column - 127, average_Row + 128, average_Column + 128)
68 | reduce_domain (Image1, Rectangle1, ImageReduced1)
69 | crop_domain (ImageReduced1, ImagePart)
70 | par_start<ThreadID> : write_image (ImagePart, 'bmp', 0, 'E:/DeVisionProject/sample0118/deffect_image/X' + average_Column$'02' + '_Y' + average_Row$'02')
71 |
72 | else
73 | test := 0
74 | endif
75 | endfor
76 | endfor
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/HdevelopFiles/stable_program_Cplusplus_0303.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | *读取参考图像
7 | read_image (Image_ref, 'C:/DeVisionProject/sample0118/reference_image.bmp')
8 | get_image_size (Image_ref, Width_ref, Height_ref)
9 | median_image (Image_ref, ImageMedian_ref, 'circle', 1, 'mirrored')
10 |
11 | *读取待检测图像
12 | read_image (Image_def, 'C:/DeVisionProject/sample0118/037.bmp')
13 | threshold (Image_def, Region_defth, 1, 255)
14 | connection (Region_defth, ConnectedRegions_defth)
15 | smallest_rectangle1 (ConnectedRegions_defth, Row_origin_def, Column_origin_def, Row_end_def, Column_end_def)
16 | reduce_domain (Image_def, ConnectedRegions_defth, ImageReduced_def)
17 | crop_domain (ImageReduced_def, ImagePart_def)
18 | median_image (ImagePart_def, ImageMedian_def, 'circle', 1, 'mirrored')
19 | get_image_size (ImageMedian_def, Width_def, Height_def)
20 | *判断图像是否有黑边
21 | if( Width_ref != Width_def or Height_ref != Height_def)
22 | reduce_domain (ImageMedian_ref, ConnectedRegions_defth, ImageReduced_ref)
23 | crop_domain (ImageReduced_ref, ImagePart_ref)
24 | abs_diff_image (ImageMedian_def, ImagePart_ref, ImageAbsDiff, 5)
25 | median_image (ImageAbsDiff, ImageMedian_absdiff, 'square', 2, 'mirrored')
26 | else
27 | *参考图像减去待检测图像,结果取绝对值
28 | *可利用放大倍数设置检测的精度和等级
29 | abs_diff_image (ImageMedian_def, ImageMedian_ref, ImageAbsDiff, 5)
30 | median_image (ImageAbsDiff, ImageMedian_absdiff, 'square', 2, 'mirrored')
31 | endif
32 |
33 | *参考图像像素平均值
34 | get_domain (ImageMedian_ref, Domain_ref)
35 | intensity (Domain_ref, ImageMedian_ref, Mean_ref, Deviation_ref)
36 | *差值图像的像素最大值
37 | min_max_gray (Domain_ref, ImageMedian_absdiff, 0, Min_ref, Max_ref, Range_ref)
38 |
39 | row_scale := Height_def / 256
40 | if(Height_def % 256 != 0)
41 | row_scale := row_scale + 1
42 | endif
43 | column_scale := Width_def / 256
44 | if(Width_def % 256 != 0)
45 | column_scale := column_scale + 1
46 | endif
47 |
48 | for rownum:=0 to row_scale-1 by 1
49 | for colnum:=0 to column_scale-1 by 1
50 | *重定义图像的定义域,分切图像
51 | gen_rectangle1 (Rectangle, rownum*256 + Row_origin_def, colnum*256 + Column_origin_def, (rownum+1)*256+ Row_origin_def, (colnum+1)*256 + Column_origin_def)
52 | *帧相减后的图像在缩减区域的像素平均值
53 | reduce_domain (ImageMedian_absdiff, Rectangle, ImageReduced_defsmall)
54 | intensity (Rectangle, ImageReduced_defsmall, Mean_small_abs_diff, Deviation_small_abs_diff)
55 | between_mean := abs(Mean_ref - Mean_small_abs_diff)
56 | *求区域内像素的最大最小值
57 | *reduce_domain (ImageAbsDiff, Rectangle, ImageReduced3)
58 | min_max_gray (Rectangle, ImageReduced_defsmall, 25, Min1, Max1, Range1)
59 | *分切后的图像动态阈值化
60 | *threshold (ImageReduced_defsmall, Region, 0.8*max([min([255,Mean * 1.2]), min([255,Mean_small_abs_diff * 1.2])]), 255)
61 | threshold (ImageReduced_defsmall, Region, min([Mean_ref*0.5, 255]), 255)
62 |
63 | *连接区域
64 | connection (Region, ConnectedRegions)
65 | *选择ROI
66 | select_shape (ConnectedRegions, SelectedRegions, 'contlength', 'and', 5, 999999)
67 |
68 | *对单张小图进行处理
69 | *计算ROI数量
70 | count_obj (SelectedRegions, Number)
71 | if(Number)
72 | total_Row := 0
73 | total_Column := 0
74 | for i:=1 to Number by 1
75 | select_obj (SelectedRegions, ObjectSelected, i)
76 | smallest_circle (ObjectSelected, Row, Column, Radius)
77 | *区域内有多个瑕疵则需要对位置进行平均
78 | total_Row := total_Row + Row
79 | total_Column := total_Column + Column
80 | endfor
81 | average_Row := total_Row / Number
82 | average_Column := total_Column / Number
83 | *缺陷在大图中的实际坐标
84 | if(average_Row < 127)
85 | average_Row := 127
86 | elseif(average_Row > 8065)
87 | average_Row := 8065
88 | endif
89 | if(average_Column < 127)
90 | average_Column := 127
91 | elseif(average_Column > 8065)
92 | average_Column := 8065
93 | endif
94 | *保存瑕疵区域图片
95 | gen_rectangle1 (Rectangle1, average_Row - 127, average_Column - 127, average_Row + 128, average_Column + 128)
96 | reduce_domain (Image_def, Rectangle1, ImageReduced1)
97 | crop_domain (ImageReduced1, ImagePart)
98 | par_start<ThreadID> : write_image (ImagePart, 'bmp', 0, 'C:/DeVisionProject/sample0118/deffect_image/X' + average_Column$'02' + '_Y' + average_Row$'02')
99 |
100 | else
101 | ResultMessage :='OK'
102 | endif
103 | endfor
104 | endfor
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/HdevelopFiles/stable_program_special.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | dev_update_off()
7 | dev_close_window()
8 |
9 | *读取参考图像
10 | read_image (Image_ref, 'C:/DeVisionProject/sample0319/reference_image_1.bmp')
11 | get_image_size (Image_ref, Width_ref, Height_ref)
12 | median_image (Image_ref, ImageMedian_ref, 'circle', 1, 'mirrored')
13 |
14 | dev_open_window (0, 0, 0.06*Width_ref, 0.06*Height_ref, 'black', WindowHandle)
15 | set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
16 | dev_set_draw ('margin')
17 | dev_set_line_width (3)
18 | dev_set_color ('red')
19 |
20 | count_seconds (Seconds)
21 | *读取待检测图像
22 | read_image (Image_def, 'C:/DeVisionProject/sample0319/c1.bmp')
23 | threshold (Image_def, Region_defth, 1, 255)
24 | connection (Region_defth, ConnectedRegions_defth)
25 | smallest_rectangle1 (ConnectedRegions_defth, Row_origin_def, Column_origin_def, Row_end_def, Column_end_def)
26 | reduce_domain (Image_def, ConnectedRegions_defth, ImageReduced_def)
27 | crop_domain (ImageReduced_def, ImagePart_def)
28 | median_image (ImagePart_def, ImageMedian_def, 'circle', 1, 'mirrored')
29 | get_image_size (ImageMedian_def, Width_def, Height_def)
30 | *判断图像是否有黑边
31 | if( Width_ref != Width_def or Height_ref != Height_def)
32 | reduce_domain (ImageMedian_ref, ConnectedRegions_defth, ImageReduced_ref)
33 | crop_domain (ImageReduced_ref, ImagePart_ref)
34 | abs_diff_image (ImageMedian_def, ImagePart_ref, ImageAbsDiff, 5)
35 | median_image (ImageAbsDiff, ImageMedian_absdiff, 'square', 2, 'mirrored')
36 | else
37 | *参考图像减去待检测图像,结果取绝对值
38 | *可利用放大倍数设置检测的精度和等级
39 | abs_diff_image (ImageMedian_def, ImageMedian_ref, ImageAbsDiff, 5)
40 | median_image (ImageAbsDiff, ImageMedian_absdiff, 'square', 2, 'mirrored')
41 | endif
42 |
43 | *参考图像像素平均值
44 | get_domain (ImageMedian_ref, Domain_ref)
45 | intensity (Domain_ref, ImageMedian_ref, Mean_ref, Deviation_ref)
46 | *差值图像的像素最大值
47 | min_max_gray (Domain_ref, ImageMedian_absdiff, 0, Min_ref, Max_ref, Range_ref)
48 |
49 | count_seconds (Seconds)
50 |
51 | row_scale := Height_def / 256
52 | if(Height_def % 256 != 0)
53 | row_scale := row_scale + 1
54 | endif
55 | column_scale := Width_def / 256
56 | if(Width_def % 256 != 0)
57 | column_scale := column_scale + 1
58 | endif
59 |
60 | for rownum:=0 to row_scale-1 by 1
61 | for colnum:=0 to column_scale-1 by 1
62 | *重定义图像的定义域,分切图像
63 | gen_rectangle1 (Rectangle, rownum*256 + Row_origin_def, colnum*256 + Column_origin_def, (rownum+1)*256+ Row_origin_def, (colnum+1)*256 + Column_origin_def)
64 | reduce_domain (ImageMedian_absdiff, Rectangle, ImageReduced_defsmall)
65 | *帧相减后的图像在缩减区域的像素平均值
66 | intensity (Rectangle, ImageReduced_defsmall, Mean_small_abs_diff, Deviation_small_abs_diff)
67 | between_mean := abs(Mean_ref - Mean_small_abs_diff)
68 | *求区域内像素的最大最小值
69 | *reduce_domain (ImageAbsDiff, Rectangle, ImageReduced3)
70 | min_max_gray (Rectangle, ImageReduced_defsmall, 25, Min_defsmall, Max_defsmall, Range_defsmall)
71 | *分切后的图像动态阈值化
72 | *threshold (ImageReduced_defsmall, Region, 0.8*max([min([255,Mean * 1.2]), min([255,Mean_small_abs_diff * 1.2])]), 255)
73 | *threshold (ImageReduced_defsmall, Region, min([Mean_ref*0.5, 255]), 255)
74 | threshold (ImageReduced_defsmall, Region, min([128, 255]), 255)
75 |
76 | *连接区域
77 | connection (Region, ConnectedRegions)
78 | *选择ROI
79 | select_shape (ConnectedRegions, SelectedRegions, 'contlength', 'and', 5, 999999)
80 | dev_set_color ('red')
81 | dev_display(Image_def)
82 | dev_display(Rectangle)
83 | dev_display(SelectedRegions)
84 | stop()
85 | *对单张小图进行处理
86 | *计算ROI数量
87 | count_obj (SelectedRegions, Number)
88 | if(Number)
89 | total_Row := 0
90 | total_Column := 0
91 | for i:=1 to Number by 1
92 | select_obj (SelectedRegions, ObjectSelected, i)
93 | smallest_circle (ObjectSelected, Row, Column, Radius)
94 | *区域内有多个瑕疵则需要对位置进行平均
95 | total_Row := total_Row + Row
96 | total_Column := total_Column + Column
97 | endfor
98 | average_Row := total_Row / Number
99 | average_Column := total_Column / Number
100 | *缺陷在大图中的实际坐标
101 | if(average_Row < 127)
102 | average_Row := 127
103 | elseif(average_Row > 8065)
104 | average_Row := 8065
105 | endif
106 | if(average_Column < 127)
107 | average_Column := 127
108 | elseif(average_Column > 8065)
109 | average_Column := 8065
110 | endif
111 | *保存瑕疵区域图片
112 | gen_rectangle1 (Rectangle1, average_Row - 127, average_Column - 127, average_Row + 128, average_Column + 128)
113 | reduce_domain (Image_def, Rectangle1, ImageReduced1)
114 | crop_domain (ImageReduced1, ImagePart)
115 | par_start<ThreadID> : write_image (ImagePart, 'bmp', 0, 'C:/DeVisionProject/sample0319/deffect_image/X' + average_Column$'02' + '_Y' + average_Row$'02')
116 | * dev_display(Image_def)
117 | * dev_set_color ('blue')
118 | * dev_display(Rectangle1)
119 | * dev_set_color('red')
120 | * dev_display(SelectedRegions)
121 | * stop()
122 | else
123 | ResultMessage :='OK'
124 | Color := 'forest green'
125 | *disp_message (WindowHandle, ResultMessage, 'window', 12, 12, Color, 'true')
126 | endif
127 | endfor
128 | endfor
129 |
130 | count_seconds (Seconds1)
131 | Time := Seconds1 -Seconds
132 | disp_message (WindowHandle, Time, 'window', 12, 12, 'red', 'true')
133 | stop()
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/HdevelopFiles/背景差分法20210226.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | dev_update_off ()
7 | dev_close_window ()
8 | read_image (Image, 'E:/DeVisionProject/OneCamera_0417/reference_image1.bmp')
9 | get_image_size (Image, Width, Height)
10 | dev_open_window (0, 0, 0.06 * Width, 0.06 * Height, 'black', WindowHandle)
11 | set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
12 | dev_set_draw ('margin')
13 | dev_set_line_width (3)
14 | dev_set_color ('red')
15 |
16 | *median_image (Image, ImageMedian, 'square', 3, 'mirrored')
17 | gen_image_const (ImageAverage, 'byte', Width, Height)
18 | gen_image_const (ImageDeviation, 'byte', Width, Height)
19 |
20 | for column := 0 to Width - 1 by 1
21 | gen_rectangle1 (Rectangle, 0, column, 8192, column + 1)
22 | intensity (Rectangle, Image, Mean, Deviation)
23 | *标准差
24 | tuple_sqrt (Deviation, Sqrt)
25 | overpaint_region (ImageAverage, Rectangle, Mean, 'fill')
26 | overpaint_region (ImageDeviation, Rectangle, min([ 5 * Sqrt,255]), 'fill')
27 | endfor
28 | *stop()
29 |
30 | read_image (Image1, 'E:/DeVisionProject/OneCamera_0417/test1_1.bmp')
31 | dev_display(Image1)
32 |
33 | *测试:手动AOP优化
34 | set_system ('parallelize_operators', 'true')
35 | get_system ('parallelize_operators', AOP)
36 | optimize_aop ('median_image', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
37 | optimize_aop ('sub_image', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
38 | optimize_aop ('add_image', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
39 | optimize_aop ('threshold', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
40 |
41 | count_seconds (Seconds1)
42 | for turn := 1 to 30 by 1
43 | *median_image (Image1, ImageMedian1, 'square', 3, 'mirrored')
44 |
45 | sub_image (Image1, ImageAverage, ImageSub1, 1, 0)
46 | sub_image (ImageAverage, Image1, ImageSub2, 1, 0)
47 | add_image (ImageSub1, ImageSub2, ImageResult, 0.5, 0)
48 | sub_image (ImageResult, ImageDeviation, ImageOut, 1, 0)
49 | threshold (ImageOut, Region, 1, 255)
50 | dilation_circle (Region, RegionDilation, 64)
51 | erosion_circle (RegionDilation, RegionErosion, 64)
52 |
53 | connection (RegionErosion, ConnectedRegions)
54 | select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 3, 65536)
55 | count_obj (SelectedRegions, Number)
56 | *select_obj (SelectedRegions, ObjectSelected, 1)
57 | dev_display(SelectedRegions)
58 | stop()
59 | endfor
60 | count_seconds (Seconds2)
61 | ResultMessage := Seconds2 - Seconds1
62 | Color := 'forest green'
63 | disp_message (WindowHandle, ResultMessage, 'window', 12, 12, Color, 'true')
64 |
65 | stop()
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/HdevelopFiles/背景差分法_add_noise_20210301.hdev:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | dev_update_off ()
7 | dev_close_window ()
8 | read_image (Image, 'E:/DeVisionProject/OneCamera_0417/reference_image1.bmp')
9 | get_image_size (Image, Width, Height)
10 | dev_open_window (0, 0, 0.06 * Width, 0.06 * Height, 'black', WindowHandle)
11 | set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
12 | dev_set_draw ('margin')
13 | dev_set_line_width (3)
14 | dev_set_color ('red')
15 |
16 | *median_image (Image, ImageMedian, 'square', 3, 'mirrored')
17 | gen_image_const (ImageAverage, 'byte', Width, Height)
18 | gen_image_const (ImageDeviation, 'byte', Width, Height)
19 |
20 | for column := 0 to Width - 1 by 1
21 | gen_rectangle1 (Rectangle, 0, column, 8192, column + 1)
22 | intensity (Rectangle, Image, Mean, Deviation)
23 | *标准差
24 | tuple_sqrt (Deviation, Sqrt)
25 | overpaint_region (ImageAverage, Rectangle, Mean, 'fill')
26 | overpaint_region (ImageDeviation, Rectangle, min([ 5 * Sqrt,255]), 'fill')
27 | endfor
28 | *stop()
29 |
30 | read_image (Image1, 'E:/DeVisionProject/OneCamera_0417/test1_1.bmp')
31 | dev_display(Image1)
32 |
33 | *测试:手动AOP优化
34 | set_system ('parallelize_operators', 'true')
35 | get_system ('parallelize_operators', AOP)
36 | optimize_aop ('median_image', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
37 | optimize_aop ('sub_image', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
38 | optimize_aop ('add_image', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
39 | optimize_aop ('threshold', 'byte', 'no_file', ['file_mode','model','parameters'], ['nil','mlp','false'])
40 |
41 | count_seconds (Seconds1)
42 | for turn := 1 to 30 by 1
43 | *median_image (Image1, ImageMedian1, 'square', 3, 'mirrored')
44 |
45 | copy_image (Image1, DupImage)
46 | dev_display(DupImage)
47 | minvalue:=0
48 | maxvalue:=255
49 | value2 := rand(1)*10
50 | totalnum := int(value2) + 1
51 | gen_random_regions (Regions, 'ellipse', 2, 300, 2, 300, 0, 0, int(value2) + 1, Width, Height)
52 | count_obj (Regions, Number)
53 | for index := 1 to Number by 1
54 | select_obj (Regions, ObjectSelected, index)
55 | value:=minvalue+rand(1)*(maxvalue-minvalue)
56 | overpaint_region (DupImage, ObjectSelected, value, 'fill')
57 | endfor
58 |
59 | sub_image (DupImage, ImageAverage, ImageSub1, 1, 0)
60 | sub_image (ImageAverage, DupImage, ImageSub2, 1, 0)
61 | add_image (ImageSub1, ImageSub2, ImageResult, 0.5, 0)
62 | sub_image (ImageResult, ImageDeviation, ImageOut, 1, 0)
63 | threshold (ImageOut, Region, 1, 255)
64 | dilation_circle (Region, RegionDilation, 64)
65 | erosion_circle (RegionDilation, RegionErosion, 64)
66 |
67 | connection (RegionErosion, ConnectedRegions)
68 | select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 3, 65536)
69 | count_obj (SelectedRegions, Number)
70 | *select_obj (SelectedRegions, ObjectSelected, 1)
71 | *dev_display(SelectedRegions)
72 | stop()
73 | endfor
74 | count_seconds (Seconds2)
75 | ResultMessage := Seconds2 - Seconds1
76 | Color := 'forest green'
77 | disp_message (WindowHandle, ResultMessage, 'window', 12, 12, Color, 'true')
78 |
79 | stop()
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/MembranceDiscoverSystem.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28307.902
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeVision", "DeVision\DeVision.vcxproj", "{1ADCDEA0-2FFD-41EC-B039-A08C841FCD90}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AcquireDevice", "AcquireDevice\AcquireDevice.vcxproj", "{D110DC51-AF15-4BDA-9468-782B4FA0E92C}"
9 | EndProject
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindCamera", "FindCamera\FindCamera.vcxproj", "{C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|x64 = Debug|x64
15 | Debug|x86 = Debug|x86
16 | Release|x64 = Release|x64
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {1ADCDEA0-2FFD-41EC-B039-A08C841FCD90}.Debug|x64.ActiveCfg = Debug|x64
21 | {1ADCDEA0-2FFD-41EC-B039-A08C841FCD90}.Debug|x64.Build.0 = Debug|x64
22 | {1ADCDEA0-2FFD-41EC-B039-A08C841FCD90}.Debug|x86.ActiveCfg = Debug|Win32
23 | {1ADCDEA0-2FFD-41EC-B039-A08C841FCD90}.Debug|x86.Build.0 = Debug|Win32
24 | {1ADCDEA0-2FFD-41EC-B039-A08C841FCD90}.Release|x64.ActiveCfg = Release|x64
25 | {1ADCDEA0-2FFD-41EC-B039-A08C841FCD90}.Release|x64.Build.0 = Release|x64
26 | {1ADCDEA0-2FFD-41EC-B039-A08C841FCD90}.Release|x86.ActiveCfg = Release|Win32
27 | {1ADCDEA0-2FFD-41EC-B039-A08C841FCD90}.Release|x86.Build.0 = Release|Win32
28 | {D110DC51-AF15-4BDA-9468-782B4FA0E92C}.Debug|x64.ActiveCfg = Debug|x64
29 | {D110DC51-AF15-4BDA-9468-782B4FA0E92C}.Debug|x64.Build.0 = Debug|x64
30 | {D110DC51-AF15-4BDA-9468-782B4FA0E92C}.Debug|x86.ActiveCfg = Debug|Win32
31 | {D110DC51-AF15-4BDA-9468-782B4FA0E92C}.Debug|x86.Build.0 = Debug|Win32
32 | {D110DC51-AF15-4BDA-9468-782B4FA0E92C}.Release|x64.ActiveCfg = Release|x64
33 | {D110DC51-AF15-4BDA-9468-782B4FA0E92C}.Release|x64.Build.0 = Release|x64
34 | {D110DC51-AF15-4BDA-9468-782B4FA0E92C}.Release|x86.ActiveCfg = Release|Win32
35 | {D110DC51-AF15-4BDA-9468-782B4FA0E92C}.Release|x86.Build.0 = Release|Win32
36 | {C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}.Debug|x64.ActiveCfg = Debug|x64
37 | {C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}.Debug|x64.Build.0 = Debug|x64
38 | {C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}.Debug|x86.ActiveCfg = Debug|Win32
39 | {C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}.Debug|x86.Build.0 = Debug|Win32
40 | {C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}.Release|x64.ActiveCfg = Release|x64
41 | {C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}.Release|x64.Build.0 = Release|x64
42 | {C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}.Release|x86.ActiveCfg = Release|Win32
43 | {C6AA676C-36E4-4EE5-A7E9-C78B5C391A5C}.Release|x86.Build.0 = Release|Win32
44 | EndGlobalSection
45 | GlobalSection(SolutionProperties) = preSolution
46 | HideSolutionNode = FALSE
47 | EndGlobalSection
48 | GlobalSection(ExtensibilityGlobals) = postSolution
49 | SolutionGuid = {EF6DB08C-BE8A-48ED-B8A1-3088FB9E39C1}
50 | EndGlobalSection
51 | EndGlobal
52 |
--------------------------------------------------------------------------------
/ODBC/1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/ODBC/1.PNG
--------------------------------------------------------------------------------
/ODBC/2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/ODBC/2.PNG
--------------------------------------------------------------------------------
/ODBC/AccessDatabaseEngine_X64.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fangliang2020ifet/CoatVisionInspection/fa603cf85677adf00b4ae9cfd72f33efb84331ac/ODBC/AccessDatabaseEngine_X64.exe
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CoatVisionInspection
2 | 薄膜瑕疵视觉检测系统,4台8K线阵相机
3 |
--------------------------------------------------------------------------------