├── .gitattributes
├── .gitignore
├── README.md
├── VisionControl.sln
├── Yoga.ImageControl
├── EnumInfo.cs
├── FunctionPlot.cs
├── FunctionPlotUnit.Designer.cs
├── FunctionPlotUnit.cs
├── FunctionPlotUnit.resx
├── GraphicsContext.cs
├── HObjectEntry.cs
├── HWndCtrl.cs
├── HWndMessage.cs
├── HWndUnit.Designer.cs
├── HWndUnit.cs
├── HWndUnit.resx
├── Mode.cs
├── PictureUnit.Designer.cs
├── PictureUnit.cs
├── PictureUnit.resx
├── Properties
│ └── AssemblyInfo.cs
├── ROI.cs
├── ROIActUnit.Designer.cs
├── ROIActUnit.cs
├── ROIActUnit.resx
├── ROICircle.cs
├── ROICircularArc.cs
├── ROIController.cs
├── ROIEventArgs.cs
├── ROILine.cs
├── ROIRectangle1.cs
├── ROIRectangle2.cs
├── ShowMessageEventArgs.cs
└── Yoga.ImageControl.csproj
├── Yoga.Native
├── GraphicsContext.cpp
├── GraphicsContext.h
├── HObjectEntry.cpp
├── HObjectEntry.h
├── HWndMessage.cpp
├── HWndMessage.h
├── NativeShowUnit.cpp
├── NativeShowUnit.h
├── ReadMe.txt
├── Util.cpp
├── Util.h
├── Yoga.Native.cpp
├── Yoga.Native.h
├── Yoga.Native.vcxproj
├── Yoga.Native.vcxproj.filters
├── dllmain.cpp
├── stdafx.cpp
├── stdafx.h
└── targetver.h
├── Yoga.Test
├── App.config
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── Yoga.Test.csproj
└── Yoga.Wrapper
├── AssemblyInfo.cpp
├── Conversion.cpp
├── Conversion.h
├── NativeTest.cpp
├── NativeTest.h
├── ReadMe.txt
├── ShowUnit.cpp
├── ShowUnit.h
├── Stdafx.cpp
├── Stdafx.h
├── UtilManaged.cpp
├── UtilManaged.h
├── Wrapper.vcxproj
├── Wrapper.vcxproj.filters
├── app.ico
├── app.rc
└── resource.h
/.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 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | [Xx]64/
19 | [Xx]86/
20 | [Bb]uild/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 |
85 | # Visual Studio profiler
86 | *.psess
87 | *.vsp
88 | *.vspx
89 | *.sap
90 |
91 | # TFS 2012 Local Workspace
92 | $tf/
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 | *.DotSettings.user
101 |
102 | # JustCode is a .NET coding add-in
103 | .JustCode
104 |
105 | # TeamCity is a build add-in
106 | _TeamCity*
107 |
108 | # DotCover is a Code Coverage Tool
109 | *.dotCover
110 |
111 | # NCrunch
112 | _NCrunch_*
113 | .*crunch*.local.xml
114 | nCrunchTemp_*
115 |
116 | # MightyMoose
117 | *.mm.*
118 | AutoTest.Net/
119 |
120 | # Web workbench (sass)
121 | .sass-cache/
122 |
123 | # Installshield output folder
124 | [Ee]xpress/
125 |
126 | # DocProject is a documentation generator add-in
127 | DocProject/buildhelp/
128 | DocProject/Help/*.HxT
129 | DocProject/Help/*.HxC
130 | DocProject/Help/*.hhc
131 | DocProject/Help/*.hhk
132 | DocProject/Help/*.hhp
133 | DocProject/Help/Html2
134 | DocProject/Help/html
135 |
136 | # Click-Once directory
137 | publish/
138 |
139 | # Publish Web Output
140 | *.[Pp]ublish.xml
141 | *.azurePubxml
142 |
143 | # TODO: Un-comment the next line if you do not want to checkin
144 | # your web deploy settings because they may include unencrypted
145 | # passwords
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # NuGet Packages
150 | *.nupkg
151 | # The packages folder can be ignored because of Package Restore
152 | **/packages/*
153 | # except build/, which is used as an MSBuild target.
154 | !**/packages/build/
155 | # Uncomment if necessary however generally it will be regenerated when needed
156 | #!**/packages/repositories.config
157 | # NuGet v3's project.json files produces more ignoreable files
158 | *.nuget.props
159 | *.nuget.targets
160 |
161 | # Microsoft Azure Build Output
162 | csx/
163 | *.build.csdef
164 |
165 | # Microsoft Azure Emulator
166 | ecf/
167 | rcf/
168 |
169 | # Windows Store app package directory
170 | AppPackages/
171 | BundleArtifacts/
172 |
173 | # Visual Studio cache files
174 | # files ending in .cache can be ignored
175 | *.[Cc]ache
176 | # but keep track of directories ending in .cache
177 | !*.[Cc]ache/
178 |
179 | # Others
180 | ClientBin/
181 | [Ss]tyle[Cc]op.*
182 | ~$*
183 | *~
184 | *.dbmdl
185 | *.dbproj.schemaview
186 | *.pfx
187 | *.publishsettings
188 | node_modules/
189 | orleans.codegen.cs
190 |
191 | # RIA/Silverlight projects
192 | Generated_Code/
193 |
194 | # Backup & report files from converting an old project file
195 | # to a newer Visual Studio version. Backup files are not needed,
196 | # because we have git ;-)
197 | _UpgradeReport_Files/
198 | Backup*/
199 | UpgradeLog*.XML
200 | UpgradeLog*.htm
201 |
202 | # SQL Server files
203 | *.mdf
204 | *.ldf
205 |
206 | # Business Intelligence projects
207 | *.rdl.data
208 | *.bim.layout
209 | *.bim_*.settings
210 |
211 | # Microsoft Fakes
212 | FakesAssemblies/
213 |
214 | # GhostDoc plugin setting file
215 | *.GhostDoc.xml
216 |
217 | # Node.js Tools for Visual Studio
218 | .ntvs_analysis.dat
219 |
220 | # Visual Studio 6 build log
221 | *.plg
222 |
223 | # Visual Studio 6 workspace options file
224 | *.opt
225 |
226 | # Visual Studio LightSwitch build output
227 | **/*.HTMLClient/GeneratedArtifacts
228 | **/*.DesktopClient/GeneratedArtifacts
229 | **/*.DesktopClient/ModelManifest.xml
230 | **/*.Server/GeneratedArtifacts
231 | **/*.Server/ModelManifest.xml
232 | _Pvt_Extensions
233 |
234 | # LightSwitch generated files
235 | GeneratedArtifacts/
236 | ModelManifest.xml
237 |
238 | # Paket dependency manager
239 | .paket/paket.exe
240 |
241 | # FAKE - F# Make
242 | .fake/
243 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VisionControl
2 | /*********************************************************************************************************
3 | *
4 | * 说明:
5 | *
6 | * halcon图像显示控件的再次封装
7 | * 20180621
8 | * 1.对于图像显示及其他操作全部封装到c++代码中避免c#对于hobject对象释放导致显示异常问题
9 | * 2.c++ cli代理对于其他自定义算法也可以按照此模式添加
10 | * 3.roi操作参考的是halcon官方实例
11 | * 4.c++代码用到了qt5
12 | * 5.开发环境为vs2015+halcon13+qt5.9.1
13 | *
14 | * 作者:林玉刚 有任何疑问或建议请联系 linyugang@foxmail.com
15 | *
16 | *********************************************************************************************************/
17 |
18 |
--------------------------------------------------------------------------------
/VisionControl.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{7392DF13-7703-4B9A-977A-2AACB0AB5E70}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CShap", "CShap", "{BC5D0D55-8C4C-4671-A0E4-3D87A8961A7E}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yoga.ImageControl", "Yoga.ImageControl\Yoga.ImageControl.csproj", "{34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}"
11 | ProjectSection(ProjectDependencies) = postProject
12 | {60B76454-1570-423C-AEC6-3B522B023633} = {60B76454-1570-423C-AEC6-3B522B023633}
13 | EndProjectSection
14 | EndProject
15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Yoga.Wrapper", "Yoga.Wrapper\Wrapper.vcxproj", "{B1AB93B2-0CF1-4580-A799-7761BFE7371E}"
16 | ProjectSection(ProjectDependencies) = postProject
17 | {60B76454-1570-423C-AEC6-3B522B023633} = {60B76454-1570-423C-AEC6-3B522B023633}
18 | EndProjectSection
19 | EndProject
20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Yoga.Native", "Yoga.Native\Yoga.Native.vcxproj", "{60B76454-1570-423C-AEC6-3B522B023633}"
21 | EndProject
22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yoga.Test", "Yoga.Test\Yoga.Test.csproj", "{1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}"
23 | EndProject
24 | Global
25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
26 | Debug|x64 = Debug|x64
27 | Debug|x86 = Debug|x86
28 | Release|x64 = Release|x64
29 | Release|x86 = Release|x86
30 | EndGlobalSection
31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
32 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}.Debug|x64.ActiveCfg = Debug|x64
33 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}.Debug|x64.Build.0 = Debug|x64
34 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}.Debug|x86.ActiveCfg = Debug|x86
35 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}.Debug|x86.Build.0 = Debug|x86
36 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}.Release|x64.ActiveCfg = Release|x64
37 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}.Release|x64.Build.0 = Release|x64
38 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}.Release|x86.ActiveCfg = Release|x86
39 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}.Release|x86.Build.0 = Release|x86
40 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E}.Debug|x64.ActiveCfg = Debug|x64
41 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E}.Debug|x64.Build.0 = Debug|x64
42 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E}.Debug|x86.ActiveCfg = Debug|Win32
43 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E}.Debug|x86.Build.0 = Debug|Win32
44 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E}.Release|x64.ActiveCfg = Release|x64
45 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E}.Release|x64.Build.0 = Release|x64
46 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E}.Release|x86.ActiveCfg = Release|Win32
47 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E}.Release|x86.Build.0 = Release|Win32
48 | {60B76454-1570-423C-AEC6-3B522B023633}.Debug|x64.ActiveCfg = Debug|x64
49 | {60B76454-1570-423C-AEC6-3B522B023633}.Debug|x64.Build.0 = Debug|x64
50 | {60B76454-1570-423C-AEC6-3B522B023633}.Debug|x86.ActiveCfg = Debug|Win32
51 | {60B76454-1570-423C-AEC6-3B522B023633}.Debug|x86.Build.0 = Debug|Win32
52 | {60B76454-1570-423C-AEC6-3B522B023633}.Release|x64.ActiveCfg = Release|x64
53 | {60B76454-1570-423C-AEC6-3B522B023633}.Release|x64.Build.0 = Release|x64
54 | {60B76454-1570-423C-AEC6-3B522B023633}.Release|x86.ActiveCfg = Release|Win32
55 | {60B76454-1570-423C-AEC6-3B522B023633}.Release|x86.Build.0 = Release|Win32
56 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}.Debug|x64.ActiveCfg = Debug|x64
57 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}.Debug|x64.Build.0 = Debug|x64
58 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}.Debug|x86.ActiveCfg = Debug|x86
59 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}.Debug|x86.Build.0 = Debug|x86
60 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}.Release|x64.ActiveCfg = Release|x64
61 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}.Release|x64.Build.0 = Release|x64
62 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}.Release|x86.ActiveCfg = Release|x86
63 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}.Release|x86.Build.0 = Release|x86
64 | EndGlobalSection
65 | GlobalSection(SolutionProperties) = preSolution
66 | HideSolutionNode = FALSE
67 | EndGlobalSection
68 | GlobalSection(NestedProjects) = preSolution
69 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7} = {BC5D0D55-8C4C-4671-A0E4-3D87A8961A7E}
70 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E} = {7392DF13-7703-4B9A-977A-2AACB0AB5E70}
71 | {60B76454-1570-423C-AEC6-3B522B023633} = {7392DF13-7703-4B9A-977A-2AACB0AB5E70}
72 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1} = {BC5D0D55-8C4C-4671-A0E4-3D87A8961A7E}
73 | EndGlobalSection
74 | EndGlobal
75 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/EnumInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | /*********************************************************************************************************
4 | *
5 | * 说明:
6 | *
7 | * halcon图像显示控件的再次封装
8 | * 20180621
9 | * 1.对于图像显示及其他操作全部封装到c++代码中避免c#对于hobject对象释放导致显示异常问题
10 | * 2.c++ cli代理对于其他自定义算法也可以按照此模式添加
11 | * 3.roi操作参考的是halcon官方实例
12 | * 4.c++代码用到了qt5
13 | * 5.开发环境为vs2015+halcon13+qt5.9.1
14 | *
15 | * 作者:林玉刚 有任何疑问或建议请联系 linyugang@foxmail.com
16 | *
17 | *********************************************************************************************************/
18 |
19 | namespace Yoga.ImageControl
20 | {
21 | [Serializable]
22 | public enum ROIType
23 | {
24 | ///
25 | /// 直线
26 | ///
27 | Line = 10,
28 | ///
29 | /// 圆
30 | ///
31 | Circle,
32 | ///
33 | /// 圆弧
34 | ///
35 | CircleArc,
36 | ///
37 | /// 矩形
38 | ///
39 | Rectangle1,
40 | ///
41 | /// 带角度矩形
42 | ///
43 | Rectangle2
44 | }
45 | ///
46 | /// ROI运算
47 | ///
48 | public enum ROIOperation
49 | {
50 | ///
51 | /// ROI求和模式
52 | ///
53 | Positive = 21,
54 | ///
55 | /// ROI求差模式
56 | ///
57 | Negative,
58 | ///
59 | /// ROI模式为无
60 | ///
61 | None,
62 | }
63 | public enum ViewMessage
64 | {
65 | /// Constant describing an update of the model region
66 | UpdateROI = 50,
67 |
68 | ChangedROISign,
69 |
70 | /// Constant describing an update of the model region
71 | MovingROI,
72 | DeletedActROI,
73 | DelectedAllROIs,
74 |
75 | ActivatedROI,
76 |
77 | MouseMove,
78 | CreatedROI,
79 | ///
80 | /// Constant describes delegate message to signal new image
81 | ///
82 | UpdateImage,
83 | ///
84 | /// Constant describes delegate message to signal error
85 | /// when reading an image from file
86 | ///
87 | ErrReadingImage,
88 | ///
89 | /// Constant describes delegate message to signal error
90 | /// when defining a graphical context
91 | ///
92 | ErrDefiningGC
93 | }
94 | public enum ShowMode
95 | {
96 | ///
97 | /// 包含ROI显示
98 | ///
99 | IncludeROI = 1,
100 | ///
101 | /// 不包含ROI显示
102 | ///
103 | ExcludeROI
104 | }
105 | public enum ResultShow
106 | {
107 | 原图,
108 | 处理后
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/FunctionPlot.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/FunctionPlot.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/FunctionPlotUnit.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Yoga.ImageControl
2 | {
3 | partial class FunctionPlotUnit
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region 组件设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.panelAxis = new System.Windows.Forms.Panel();
32 | this.groupBox9 = new System.Windows.Forms.GroupBox();
33 | this.labelDeviation = new System.Windows.Forms.Label();
34 | this.labelMean = new System.Windows.Forms.Label();
35 | this.labelRange = new System.Windows.Forms.Label();
36 | this.labelPeak = new System.Windows.Forms.Label();
37 | this.label24 = new System.Windows.Forms.Label();
38 | this.label25 = new System.Windows.Forms.Label();
39 | this.labelRangeX = new System.Windows.Forms.Label();
40 | this.labelPeakX = new System.Windows.Forms.Label();
41 | this.label23 = new System.Windows.Forms.Label();
42 | this.label22 = new System.Windows.Forms.Label();
43 | this.label19 = new System.Windows.Forms.Label();
44 | this.label18 = new System.Windows.Forms.Label();
45 | this.lblY = new System.Windows.Forms.Label();
46 | this.lblX = new System.Windows.Forms.Label();
47 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
48 | this.groupBox9.SuspendLayout();
49 | this.tableLayoutPanel1.SuspendLayout();
50 | this.SuspendLayout();
51 | //
52 | // panelAxis
53 | //
54 | this.panelAxis.Dock = System.Windows.Forms.DockStyle.Fill;
55 | this.panelAxis.Location = new System.Drawing.Point(3, 3);
56 | this.panelAxis.Name = "panelAxis";
57 | this.panelAxis.Size = new System.Drawing.Size(396, 161);
58 | this.panelAxis.TabIndex = 6;
59 | //
60 | // groupBox9
61 | //
62 | this.groupBox9.Controls.Add(this.labelDeviation);
63 | this.groupBox9.Controls.Add(this.labelMean);
64 | this.groupBox9.Controls.Add(this.labelRange);
65 | this.groupBox9.Controls.Add(this.labelPeak);
66 | this.groupBox9.Controls.Add(this.label24);
67 | this.groupBox9.Controls.Add(this.label25);
68 | this.groupBox9.Controls.Add(this.labelRangeX);
69 | this.groupBox9.Controls.Add(this.labelPeakX);
70 | this.groupBox9.Controls.Add(this.label23);
71 | this.groupBox9.Controls.Add(this.label22);
72 | this.groupBox9.Controls.Add(this.label19);
73 | this.groupBox9.Controls.Add(this.label18);
74 | this.groupBox9.Controls.Add(this.lblY);
75 | this.groupBox9.Controls.Add(this.lblX);
76 | this.groupBox9.Location = new System.Drawing.Point(3, 170);
77 | this.groupBox9.Name = "groupBox9";
78 | this.groupBox9.Size = new System.Drawing.Size(386, 117);
79 | this.groupBox9.TabIndex = 5;
80 | this.groupBox9.TabStop = false;
81 | this.groupBox9.Text = "统计";
82 | //
83 | // labelDeviation
84 | //
85 | this.labelDeviation.Location = new System.Drawing.Point(269, 95);
86 | this.labelDeviation.Name = "labelDeviation";
87 | this.labelDeviation.Size = new System.Drawing.Size(86, 17);
88 | this.labelDeviation.TabIndex = 18;
89 | this.labelDeviation.Text = "0";
90 | this.labelDeviation.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
91 | //
92 | // labelMean
93 | //
94 | this.labelMean.Location = new System.Drawing.Point(269, 78);
95 | this.labelMean.Name = "labelMean";
96 | this.labelMean.Size = new System.Drawing.Size(86, 17);
97 | this.labelMean.TabIndex = 17;
98 | this.labelMean.Text = "0";
99 | this.labelMean.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
100 | //
101 | // labelRange
102 | //
103 | this.labelRange.Location = new System.Drawing.Point(269, 60);
104 | this.labelRange.Name = "labelRange";
105 | this.labelRange.Size = new System.Drawing.Size(115, 18);
106 | this.labelRange.TabIndex = 15;
107 | this.labelRange.Text = "0 ... 0";
108 | this.labelRange.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
109 | //
110 | // labelPeak
111 | //
112 | this.labelPeak.Location = new System.Drawing.Point(269, 43);
113 | this.labelPeak.Name = "labelPeak";
114 | this.labelPeak.Size = new System.Drawing.Size(86, 17);
115 | this.labelPeak.TabIndex = 14;
116 | this.labelPeak.Text = "0";
117 | this.labelPeak.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
118 | //
119 | // label24
120 | //
121 | this.label24.Location = new System.Drawing.Point(154, 95);
122 | this.label24.Name = "label24";
123 | this.label24.Size = new System.Drawing.Size(86, 17);
124 | this.label24.TabIndex = 13;
125 | this.label24.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
126 | //
127 | // label25
128 | //
129 | this.label25.Location = new System.Drawing.Point(154, 78);
130 | this.label25.Name = "label25";
131 | this.label25.Size = new System.Drawing.Size(86, 17);
132 | this.label25.TabIndex = 12;
133 | this.label25.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
134 | //
135 | // labelRangeX
136 | //
137 | this.labelRangeX.Location = new System.Drawing.Point(154, 60);
138 | this.labelRangeX.Name = "labelRangeX";
139 | this.labelRangeX.Size = new System.Drawing.Size(86, 18);
140 | this.labelRangeX.TabIndex = 9;
141 | this.labelRangeX.Text = "0 ... 0";
142 | this.labelRangeX.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
143 | //
144 | // labelPeakX
145 | //
146 | this.labelPeakX.Location = new System.Drawing.Point(154, 43);
147 | this.labelPeakX.Name = "labelPeakX";
148 | this.labelPeakX.Size = new System.Drawing.Size(86, 17);
149 | this.labelPeakX.TabIndex = 8;
150 | this.labelPeakX.Text = "0";
151 | this.labelPeakX.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
152 | //
153 | // label23
154 | //
155 | this.label23.Location = new System.Drawing.Point(19, 95);
156 | this.label23.Name = "label23";
157 | this.label23.Size = new System.Drawing.Size(106, 17);
158 | this.label23.TabIndex = 7;
159 | this.label23.Text = "偏差:";
160 | this.label23.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
161 | //
162 | // label22
163 | //
164 | this.label22.Location = new System.Drawing.Point(19, 78);
165 | this.label22.Name = "label22";
166 | this.label22.Size = new System.Drawing.Size(106, 17);
167 | this.label22.TabIndex = 6;
168 | this.label22.Text = "平均值:";
169 | this.label22.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
170 | //
171 | // label19
172 | //
173 | this.label19.Location = new System.Drawing.Point(19, 60);
174 | this.label19.Name = "label19";
175 | this.label19.Size = new System.Drawing.Size(106, 18);
176 | this.label19.TabIndex = 3;
177 | this.label19.Text = "范围:";
178 | this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
179 | //
180 | // label18
181 | //
182 | this.label18.Location = new System.Drawing.Point(19, 43);
183 | this.label18.Name = "label18";
184 | this.label18.Size = new System.Drawing.Size(106, 17);
185 | this.label18.TabIndex = 2;
186 | this.label18.Text = "峰值:";
187 | this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
188 | //
189 | // lblY
190 | //
191 | this.lblY.Location = new System.Drawing.Point(269, 17);
192 | this.lblY.Name = "lblY";
193 | this.lblY.Size = new System.Drawing.Size(105, 17);
194 | this.lblY.TabIndex = 1;
195 | this.lblY.Text = "灰度值";
196 | this.lblY.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
197 | //
198 | // lblX
199 | //
200 | this.lblX.Location = new System.Drawing.Point(154, 17);
201 | this.lblX.Name = "lblX";
202 | this.lblX.Size = new System.Drawing.Size(105, 17);
203 | this.lblX.TabIndex = 0;
204 | this.lblX.Text = "x-值";
205 | this.lblX.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
206 | //
207 | // tableLayoutPanel1
208 | //
209 | this.tableLayoutPanel1.ColumnCount = 1;
210 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
211 | this.tableLayoutPanel1.Controls.Add(this.panelAxis, 0, 0);
212 | this.tableLayoutPanel1.Controls.Add(this.groupBox9, 0, 1);
213 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
214 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
215 | this.tableLayoutPanel1.Name = "tableLayoutPanel1";
216 | this.tableLayoutPanel1.RowCount = 2;
217 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 57.14286F));
218 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 42.85714F));
219 | this.tableLayoutPanel1.Size = new System.Drawing.Size(402, 293);
220 | this.tableLayoutPanel1.TabIndex = 0;
221 | //
222 | // FunctionPlotUnit
223 | //
224 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
225 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
226 | this.Controls.Add(this.tableLayoutPanel1);
227 | this.Name = "FunctionPlotUnit";
228 | this.Size = new System.Drawing.Size(402, 293);
229 | this.groupBox9.ResumeLayout(false);
230 | this.tableLayoutPanel1.ResumeLayout(false);
231 | this.ResumeLayout(false);
232 |
233 | }
234 |
235 | #endregion
236 |
237 | private System.Windows.Forms.Panel panelAxis;
238 | private System.Windows.Forms.GroupBox groupBox9;
239 | private System.Windows.Forms.Label labelDeviation;
240 | private System.Windows.Forms.Label labelMean;
241 | private System.Windows.Forms.Label labelRange;
242 | private System.Windows.Forms.Label labelPeak;
243 | private System.Windows.Forms.Label label24;
244 | private System.Windows.Forms.Label label25;
245 | private System.Windows.Forms.Label labelRangeX;
246 | private System.Windows.Forms.Label labelPeakX;
247 | private System.Windows.Forms.Label label23;
248 | private System.Windows.Forms.Label label22;
249 | private System.Windows.Forms.Label label19;
250 | private System.Windows.Forms.Label label18;
251 | private System.Windows.Forms.Label lblY;
252 | private System.Windows.Forms.Label lblX;
253 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
254 | }
255 | }
256 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/FunctionPlotUnit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using HalconDotNet;
11 |
12 | namespace Yoga.ImageControl
13 | {
14 | public partial class FunctionPlotUnit : UserControl
15 | {
16 |
17 | private FunctionPlot plotGraphWindow;
18 |
19 |
20 | public FunctionPlotUnit()
21 | {
22 | InitializeComponent();
23 |
24 | plotGraphWindow = new FunctionPlot(panelAxis, true);
25 | plotGraphWindow.SetAxisAdaption(FunctionPlot.AXIS_RANGE_FIXED, 255.0f);
26 | }
27 | public void SetAxisAdaption(int mode)
28 | {
29 | plotGraphWindow.SetAxisAdaption(mode);
30 | }
31 | public void SetLabel(string x, string y)
32 | {
33 | plotGraphWindow.SetLabel(x, y);
34 | lblX.Text = x;
35 | lblY.Text = y;
36 | }
37 | public void ComputeStatistics(HTuple grayVals)
38 | {
39 | HTuple tuple, val;
40 | int max = 0;
41 |
42 | if (grayVals != null && grayVals.Length > 1)
43 | {
44 | tuple = new HTuple(grayVals);
45 |
46 | val = tuple.TupleMean();
47 | labelMean.Text = val[0].D.ToString("f2");
48 | val = tuple.TupleDeviation();
49 | labelDeviation.Text = val[0].D.ToString("f2");
50 |
51 | val = tuple.TupleSortIndex();
52 | labelPeakX.Text = val[val.Length - 1].I + "";
53 | max = (int)tuple[val[val.Length - 1].I].D;
54 | labelPeak.Text = max + "";
55 |
56 | labelRange.Text = (int)tuple[0].D + " ... " + (int)tuple[tuple.Length - 1].D;
57 | labelRangeX.Text = "0 ... " + (tuple.Length - 1);
58 | }
59 | else
60 | {
61 | labelMean.Text = "0";
62 | labelDeviation.Text = "0";
63 |
64 | labelPeakX.Text = "0";
65 | labelPeak.Text = "0";
66 |
67 | labelRange.Text = "0 ... 0";
68 | labelRangeX.Text = "0 ... 0";
69 | }
70 | }
71 | /// Adjusts statistics of measure projection (line profile).
72 | public void ComputeStatistics(double[] grayVals)
73 | {
74 | if (grayVals != null && grayVals.Length > 1)
75 | {
76 | ComputeStatistics(new HTuple(grayVals));
77 | }
78 | else
79 | {
80 | ComputeStatistics((HTuple)null);
81 | }
82 | }
83 | ///
84 | ///设置灰度曲线的值数组
85 | ///
86 | ///
87 | /// 灰度曲线上y(灰度)的值
88 | ///
89 | public void SetFunctionPlotValue(double[] grayValues)
90 | {
91 | plotGraphWindow.drawFunction(new HTuple(grayValues));
92 | }
93 |
94 | ///
95 | ///设置灰度曲线的值数组
96 | ///
97 | ///
98 | /// 灰度曲线上y(灰度)的值
99 | ///
100 | public void SetFunctionPlotValue(HTuple grayValues)
101 | {
102 | plotGraphWindow.drawFunction(grayValues);
103 | }
104 | ///
105 | ///设置灰度曲线的值数组
106 | ///
107 | ///
108 | /// 灰度曲线上y(灰度)的值
109 | ///
110 | public void SetFunctionPlotValue(float[] grayValues)
111 | {
112 | plotGraphWindow.drawFunction(new HTuple(grayValues));
113 | }
114 |
115 |
116 | ///
117 | ///设置灰度曲线的值数组
118 | ///
119 | ///
120 | /// 灰度曲线上y(灰度)的值
121 | ///
122 | public void SetFunctionPlotValue(int[] grayValues)
123 | {
124 | plotGraphWindow.drawFunction(new HTuple(grayValues));
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/FunctionPlotUnit.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/GraphicsContext.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/GraphicsContext.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/HObjectEntry.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/HObjectEntry.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/HWndMessage.cs:
--------------------------------------------------------------------------------
1 | using HalconDotNet;
2 | /*********************************************************************************************************
3 | *
4 | * 说明:
5 | *
6 | * halcon图像显示控件的再次封装
7 | * 20180621
8 | * 1.对于图像显示及其他操作全部封装到c++代码中避免c#对于hobject对象释放导致显示异常问题
9 | * 2.c++ cli代理对于其他自定义算法也可以按照此模式添加
10 | * 3.roi操作参考的是halcon官方实例
11 | * 4.c++代码用到了qt5
12 | * 5.开发环境为vs2015+halcon13+qt5.9.1
13 | *
14 | * 作者:林玉刚 有任何疑问或建议请联系 linyugang@foxmail.com
15 | *
16 | *********************************************************************************************************/
17 |
18 |
19 | namespace Yoga.ImageControl
20 | {
21 | public class HWndMessage
22 | {
23 |
24 | private string message;
25 | private int size = 16;
26 | private int row;
27 | private int colunm;
28 | private string color = "green";
29 | public HWndMessage(string message, int row, int colunm, int size, string color)
30 | {
31 | this.message = message;
32 | this.size = size;
33 | this.row = row;
34 | this.colunm = colunm;
35 | this.color = color;
36 |
37 | }
38 | public HWndMessage(string message, int row, int colunm)
39 | {
40 | this.message = message;
41 | this.row = row;
42 | this.colunm = colunm;
43 | }
44 | public double CahangeDisplayFontSize(HTuple Window, double zoom,double sizeOld)
45 | {
46 | double currentSize = size * zoom;
47 | if (currentSize!=sizeOld)
48 | {
49 | //Util.Notify(string.Format("字体设置中"));
50 | set_display_font(Window, currentSize, "serif", "true", "false");
51 | }
52 | //HTuple showStart;
53 | //HOperatorSet.CountSeconds(out showStart);
54 |
55 | return currentSize;
56 | //HTuple showEnd2;
57 | //HOperatorSet.CountSeconds(out showEnd2);
58 | //double timeShow2 = (showEnd2 - showStart) * 1000.0;
59 | //Util.Notify(string.Format("字体设置用时{0:f2}ms", timeShow2));
60 | }
61 | public void DispMessage(HTuple Window, string coordSystem)
62 | {
63 | //HTuple showStart;
64 | //HOperatorSet.CountSeconds(out showStart);
65 |
66 |
67 | disp_message(Window, message, coordSystem, row, colunm, color, "false");
68 | //HTuple showEnd2;
69 | //HOperatorSet.CountSeconds(out showEnd2);
70 | //double timeShow2 = (showEnd2 - showStart) * 1000.0;
71 | //Util.Notify(string.Format("文字显示1用时{0:f2}ms", timeShow2));
72 |
73 | }
74 | public void DispMessage(HTuple Window, string coordSystem, double zoom)
75 | {
76 | set_display_font(Window, size * zoom, "serif", "true", "false");
77 |
78 |
79 | disp_message(Window, message, coordSystem, row, colunm, color, "false");
80 |
81 | }
82 | public void disp_message(HTuple hv_WindowHandle, HTuple hv_String, HTuple hv_CoordSystem,
83 | HTuple hv_Row, HTuple hv_Column, HTuple hv_Color, HTuple hv_Box)
84 | {
85 |
86 |
87 |
88 | // Local iconic variables
89 |
90 | // Local control variables
91 |
92 | HTuple hv_GenParamName = null, hv_GenParamValue = null;
93 | HTuple hv_Color_COPY_INP_TMP = hv_Color.Clone();
94 | HTuple hv_Column_COPY_INP_TMP = hv_Column.Clone();
95 | HTuple hv_CoordSystem_COPY_INP_TMP = hv_CoordSystem.Clone();
96 | HTuple hv_Row_COPY_INP_TMP = hv_Row.Clone();
97 |
98 | // Initialize local and output iconic variables
99 | //This procedure displays text in a graphics window.
100 | //
101 | //Input parameters:
102 | //WindowHandle: The WindowHandle of the graphics window, where
103 | // the message should be displayed
104 | //String: A tuple of strings containing the text message to be displayed
105 | //CoordSystem: If set to 'window', the text position is given
106 | // with respect to the window coordinate system.
107 | // If set to 'image', image coordinates are used.
108 | // (This may be useful in zoomed images.)
109 | //Row: The row coordinate of the desired text position
110 | // A tuple of values is allowed to display text at different
111 | // positions.
112 | //Column: The column coordinate of the desired text position
113 | // A tuple of values is allowed to display text at different
114 | // positions.
115 | //Color: defines the color of the text as string.
116 | // If set to [], '' or 'auto' the currently set color is used.
117 | // If a tuple of strings is passed, the colors are used cyclically...
118 | // - if |Row| == |Column| == 1: for each new textline
119 | // = else for each text position.
120 | //Box: If Box[0] is set to 'true', the text is written within an orange box.
121 | // If set to' false', no box is displayed.
122 | // If set to a color string (e.g. 'white', '#FF00CC', etc.),
123 | // the text is written in a box of that color.
124 | // An optional second value for Box (Box[1]) controls if a shadow is displayed:
125 | // 'true' -> display a shadow in a default color
126 | // 'false' -> display no shadow
127 | // otherwise -> use given string as color string for the shadow color
128 | //
129 | //It is possible to display multiple text strings in a single call.
130 | //In this case, some restrictions apply:
131 | //- Multiple text positions can be defined by specifying a tuple
132 | // with multiple Row and/or Column coordinates, i.e.:
133 | // - |Row| == n, |Column| == n
134 | // - |Row| == n, |Column| == 1
135 | // - |Row| == 1, |Column| == n
136 | //- If |Row| == |Column| == 1,
137 | // each element of String is display in a new textline.
138 | //- If multiple positions or specified, the number of Strings
139 | // must match the number of positions, i.e.:
140 | // - Either |String| == n (each string is displayed at the
141 | // corresponding position),
142 | // - or |String| == 1 (The string is displayed n times).
143 | //
144 | //
145 | //Convert the parameters for disp_text.
146 | if ((int)((new HTuple(hv_Row_COPY_INP_TMP.TupleEqual(new HTuple()))).TupleOr(
147 | new HTuple(hv_Column_COPY_INP_TMP.TupleEqual(new HTuple())))) != 0)
148 | {
149 |
150 | return;
151 | }
152 | if ((int)(new HTuple(hv_Row_COPY_INP_TMP.TupleEqual(-1))) != 0)
153 | {
154 | hv_Row_COPY_INP_TMP = 12;
155 | }
156 | if ((int)(new HTuple(hv_Column_COPY_INP_TMP.TupleEqual(-1))) != 0)
157 | {
158 | hv_Column_COPY_INP_TMP = 12;
159 | }
160 | //
161 | //Convert the parameter Box to generic parameters.
162 | hv_GenParamName = new HTuple();
163 | hv_GenParamValue = new HTuple();
164 | if ((int)(new HTuple((new HTuple(hv_Box.TupleLength())).TupleGreater(0))) != 0)
165 | {
166 | if ((int)(new HTuple(((hv_Box.TupleSelect(0))).TupleEqual("false"))) != 0)
167 | {
168 | //Display no box
169 | hv_GenParamName = hv_GenParamName.TupleConcat("box");
170 | hv_GenParamValue = hv_GenParamValue.TupleConcat("false");
171 | }
172 | else if ((int)(new HTuple(((hv_Box.TupleSelect(0))).TupleNotEqual("true"))) != 0)
173 | {
174 | //Set a color other than the default.
175 | hv_GenParamName = hv_GenParamName.TupleConcat("box_color");
176 | hv_GenParamValue = hv_GenParamValue.TupleConcat(hv_Box.TupleSelect(0));
177 | }
178 | }
179 | if ((int)(new HTuple((new HTuple(hv_Box.TupleLength())).TupleGreater(1))) != 0)
180 | {
181 | if ((int)(new HTuple(((hv_Box.TupleSelect(1))).TupleEqual("false"))) != 0)
182 | {
183 | //Display no shadow.
184 | hv_GenParamName = hv_GenParamName.TupleConcat("shadow");
185 | hv_GenParamValue = hv_GenParamValue.TupleConcat("false");
186 | }
187 | else if ((int)(new HTuple(((hv_Box.TupleSelect(1))).TupleNotEqual("true"))) != 0)
188 | {
189 | //Set a shadow color other than the default.
190 | hv_GenParamName = hv_GenParamName.TupleConcat("shadow_color");
191 | hv_GenParamValue = hv_GenParamValue.TupleConcat(hv_Box.TupleSelect(1));
192 | }
193 | }
194 | //Restore default CoordSystem behavior.
195 | if ((int)(new HTuple(hv_CoordSystem_COPY_INP_TMP.TupleNotEqual("window"))) != 0)
196 | {
197 | hv_CoordSystem_COPY_INP_TMP = "image";
198 | }
199 | //
200 | if ((int)(new HTuple(hv_Color_COPY_INP_TMP.TupleEqual(""))) != 0)
201 | {
202 | //disp_text does not accept an empty string for Color.
203 | hv_Color_COPY_INP_TMP = new HTuple();
204 | }
205 | //
206 | HOperatorSet.DispText(hv_WindowHandle, hv_String, hv_CoordSystem_COPY_INP_TMP,
207 | hv_Row_COPY_INP_TMP, hv_Column_COPY_INP_TMP, hv_Color_COPY_INP_TMP, hv_GenParamName,
208 | hv_GenParamValue);
209 |
210 | return;
211 | }
212 |
213 |
214 | public void set_display_font(HTuple hv_WindowHandle, HTuple hv_Size, HTuple hv_Font,
215 | HTuple hv_Bold, HTuple hv_Slant)
216 | {
217 |
218 |
219 |
220 | // Local iconic variables
221 |
222 | // Local control variables
223 |
224 | HTuple hv_OS = null, hv_Fonts = new HTuple();
225 | HTuple hv_Style = null, hv_Exception = new HTuple(), hv_AvailableFonts = null;
226 | HTuple hv_Fdx = null, hv_Indices = new HTuple();
227 | HTuple hv_Font_COPY_INP_TMP = hv_Font.Clone();
228 | HTuple hv_Size_COPY_INP_TMP = hv_Size.Clone();
229 |
230 | // Initialize local and output iconic variables
231 | //This procedure sets the text font of the current window with
232 | //the specified attributes.
233 | //
234 | //Input parameters:
235 | //WindowHandle: The graphics window for which the font will be set
236 | //Size: The font size. If Size=-1, the default of 16 is used.
237 | //Bold: If set to 'true', a bold font is used
238 | //Slant: If set to 'true', a slanted font is used
239 | //
240 | HOperatorSet.GetSystem("operating_system", out hv_OS);
241 | // dev_get_preferences(...); only in hdevelop
242 | // dev_set_preferences(...); only in hdevelop
243 | if ((int)((new HTuple(hv_Size_COPY_INP_TMP.TupleEqual(new HTuple()))).TupleOr(
244 | new HTuple(hv_Size_COPY_INP_TMP.TupleEqual(-1)))) != 0)
245 | {
246 | hv_Size_COPY_INP_TMP = 16;
247 | }
248 | if ((int)(new HTuple(((hv_OS.TupleSubstr(0, 2))).TupleEqual("Win"))) != 0)
249 | {
250 | //Restore previous behaviour
251 | hv_Size_COPY_INP_TMP = ((1.13677 * hv_Size_COPY_INP_TMP)).TupleInt();
252 | }
253 | if ((int)(new HTuple(hv_Font_COPY_INP_TMP.TupleEqual("Courier"))) != 0)
254 | {
255 | hv_Fonts = new HTuple();
256 | hv_Fonts[0] = "Courier";
257 | hv_Fonts[1] = "Courier 10 Pitch";
258 | hv_Fonts[2] = "Courier New";
259 | hv_Fonts[3] = "CourierNew";
260 | }
261 | else if ((int)(new HTuple(hv_Font_COPY_INP_TMP.TupleEqual("mono"))) != 0)
262 | {
263 | hv_Fonts = new HTuple();
264 | hv_Fonts[0] = "Consolas";
265 | hv_Fonts[1] = "Menlo";
266 | hv_Fonts[2] = "Courier";
267 | hv_Fonts[3] = "Courier 10 Pitch";
268 | hv_Fonts[4] = "FreeMono";
269 | }
270 | else if ((int)(new HTuple(hv_Font_COPY_INP_TMP.TupleEqual("sans"))) != 0)
271 | {
272 | hv_Fonts = new HTuple();
273 | hv_Fonts[0] = "Luxi Sans";
274 | hv_Fonts[1] = "DejaVu Sans";
275 | hv_Fonts[2] = "FreeSans";
276 | hv_Fonts[3] = "Arial";
277 | }
278 | else if ((int)(new HTuple(hv_Font_COPY_INP_TMP.TupleEqual("serif"))) != 0)
279 | {
280 | hv_Fonts = new HTuple();
281 | hv_Fonts[0] = "Times New Roman";
282 | hv_Fonts[1] = "Luxi Serif";
283 | hv_Fonts[2] = "DejaVu Serif";
284 | hv_Fonts[3] = "FreeSerif";
285 | hv_Fonts[4] = "Utopia";
286 | }
287 | else
288 | {
289 | hv_Fonts = hv_Font_COPY_INP_TMP.Clone();
290 | }
291 | hv_Style = "";
292 | if ((int)(new HTuple(hv_Bold.TupleEqual("true"))) != 0)
293 | {
294 | hv_Style = hv_Style + "Bold";
295 | }
296 | else if ((int)(new HTuple(hv_Bold.TupleNotEqual("false"))) != 0)
297 | {
298 | hv_Exception = "Wrong value of control parameter Bold";
299 | throw new HalconException(hv_Exception);
300 | }
301 | if ((int)(new HTuple(hv_Slant.TupleEqual("true"))) != 0)
302 | {
303 | hv_Style = hv_Style + "Italic";
304 | }
305 | else if ((int)(new HTuple(hv_Slant.TupleNotEqual("false"))) != 0)
306 | {
307 | hv_Exception = "Wrong value of control parameter Slant";
308 | throw new HalconException(hv_Exception);
309 | }
310 | if ((int)(new HTuple(hv_Style.TupleEqual(""))) != 0)
311 | {
312 | hv_Style = "Normal";
313 | }
314 | HOperatorSet.QueryFont(hv_WindowHandle, out hv_AvailableFonts);
315 | hv_Font_COPY_INP_TMP = "";
316 | for (hv_Fdx = 0; (int)hv_Fdx <= (int)((new HTuple(hv_Fonts.TupleLength())) - 1); hv_Fdx = (int)hv_Fdx + 1)
317 | {
318 | hv_Indices = hv_AvailableFonts.TupleFind(hv_Fonts.TupleSelect(hv_Fdx));
319 | if ((int)(new HTuple((new HTuple(hv_Indices.TupleLength())).TupleGreater(0))) != 0)
320 | {
321 | if ((int)(new HTuple(((hv_Indices.TupleSelect(0))).TupleGreaterEqual(0))) != 0)
322 | {
323 | hv_Font_COPY_INP_TMP = hv_Fonts.TupleSelect(hv_Fdx);
324 | break;
325 | }
326 | }
327 | }
328 | if ((int)(new HTuple(hv_Font_COPY_INP_TMP.TupleEqual(""))) != 0)
329 | {
330 | throw new HalconException("Wrong value of control parameter Font");
331 | }
332 | hv_Font_COPY_INP_TMP = (((hv_Font_COPY_INP_TMP + "-") + hv_Style) + "-") + hv_Size_COPY_INP_TMP;
333 | HOperatorSet.SetFont(hv_WindowHandle, hv_Font_COPY_INP_TMP);
334 | // dev_set_preferences(...); only in hdevelop
335 |
336 | return;
337 | }
338 | }
339 | }
340 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/HWndUnit.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Yoga.ImageControl
2 | {
3 | partial class HWndUnit
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region 组件设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.lblMouseMessage = new System.Windows.Forms.Label();
32 | this.lblName = new System.Windows.Forms.Label();
33 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
34 | this.hWindowControl1 = new HalconDotNet.HWindowControl();
35 | this.labelResult = new System.Windows.Forms.Label();
36 | this.tableLayoutPanel1.SuspendLayout();
37 | this.SuspendLayout();
38 | //
39 | // lblMouseMessage
40 | //
41 | this.lblMouseMessage.AutoSize = true;
42 | this.lblMouseMessage.Location = new System.Drawing.Point(3, 290);
43 | this.lblMouseMessage.Name = "lblMouseMessage";
44 | this.lblMouseMessage.Size = new System.Drawing.Size(53, 12);
45 | this.lblMouseMessage.TabIndex = 86;
46 | this.lblMouseMessage.Text = "图像信息";
47 | this.lblMouseMessage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
48 | this.lblMouseMessage.Visible = false;
49 | //
50 | // lblName
51 | //
52 | this.lblName.AutoSize = true;
53 | this.lblName.Location = new System.Drawing.Point(158, 290);
54 | this.lblName.Name = "lblName";
55 | this.lblName.Size = new System.Drawing.Size(35, 12);
56 | this.lblName.TabIndex = 88;
57 | this.lblName.Text = "相机1";
58 | this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
59 | this.lblName.Visible = false;
60 | //
61 | // tableLayoutPanel1
62 | //
63 | this.tableLayoutPanel1.ColumnCount = 2;
64 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
65 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
66 | this.tableLayoutPanel1.Controls.Add(this.lblName, 1, 1);
67 | this.tableLayoutPanel1.Controls.Add(this.lblMouseMessage, 0, 1);
68 | this.tableLayoutPanel1.Controls.Add(this.hWindowControl1, 0, 0);
69 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
70 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
71 | this.tableLayoutPanel1.Name = "tableLayoutPanel1";
72 | this.tableLayoutPanel1.RowCount = 2;
73 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 95.09296F));
74 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.907046F));
75 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
76 | this.tableLayoutPanel1.Size = new System.Drawing.Size(311, 305);
77 | this.tableLayoutPanel1.TabIndex = 89;
78 | //
79 | // hWindowControl1
80 | //
81 | this.hWindowControl1.BackColor = System.Drawing.Color.DimGray;
82 | this.hWindowControl1.BorderColor = System.Drawing.Color.DimGray;
83 | this.tableLayoutPanel1.SetColumnSpan(this.hWindowControl1, 2);
84 | this.hWindowControl1.Dock = System.Windows.Forms.DockStyle.Fill;
85 | this.hWindowControl1.ImagePart = new System.Drawing.Rectangle(0, 0, 478, 400);
86 | this.hWindowControl1.Location = new System.Drawing.Point(3, 3);
87 | this.hWindowControl1.MinimumSize = new System.Drawing.Size(10, 10);
88 | this.hWindowControl1.Name = "hWindowControl1";
89 | this.hWindowControl1.Size = new System.Drawing.Size(305, 284);
90 | this.hWindowControl1.TabIndex = 0;
91 | this.hWindowControl1.WindowSize = new System.Drawing.Size(305, 284);
92 | //
93 | // labelResult
94 | //
95 | this.labelResult.BackColor = System.Drawing.Color.Transparent;
96 | this.labelResult.Font = new System.Drawing.Font("宋体", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
97 | this.labelResult.ForeColor = System.Drawing.Color.Black;
98 | this.labelResult.Location = new System.Drawing.Point(0, 0);
99 | this.labelResult.Name = "labelResult";
100 | this.labelResult.Size = new System.Drawing.Size(59, 40);
101 | this.labelResult.TabIndex = 90;
102 | this.labelResult.Text = "OK";
103 | this.labelResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
104 | this.labelResult.Visible = false;
105 | //
106 | // HWndUnit
107 | //
108 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
109 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
110 | this.BackColor = System.Drawing.SystemColors.Control;
111 | this.Controls.Add(this.labelResult);
112 | this.Controls.Add(this.tableLayoutPanel1);
113 | this.MinimumSize = new System.Drawing.Size(10, 10);
114 | this.Name = "HWndUnit";
115 | this.Size = new System.Drawing.Size(311, 305);
116 | this.Load += new System.EventHandler(this.HWndUnit_Load);
117 | this.SizeChanged += new System.EventHandler(this.HWndUnit_SizeChanged);
118 | this.tableLayoutPanel1.ResumeLayout(false);
119 | this.tableLayoutPanel1.PerformLayout();
120 | this.ResumeLayout(false);
121 |
122 | }
123 |
124 | #endregion
125 | private System.Windows.Forms.Label lblMouseMessage;
126 | private System.Windows.Forms.Label lblName;
127 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
128 | private HalconDotNet.HWindowControl hWindowControl1;
129 | private System.Windows.Forms.Label labelResult;
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/HWndUnit.cs:
--------------------------------------------------------------------------------
1 | using HalconDotNet;
2 | using System;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 |
6 | namespace Yoga.ImageControl
7 | {
8 | public partial class HWndUnit : UserControl
9 | {
10 | private HWndCtrl hWndCtrl;
11 | private string cameraName;
12 | public HWndUnit()
13 | {
14 | InitializeComponent();
15 | hWindowControl1.Size = this.Size;
16 | this.Disposed += HWndUnit_Disposed;
17 | }
18 |
19 | private void HWndUnit_Disposed(object sender, EventArgs e)
20 | {
21 |
22 | hWndCtrl.ClearWindowData();
23 | }
24 |
25 | public HWndCtrl HWndCtrl
26 | {
27 | get
28 | {
29 | if (hWndCtrl == null)
30 | {
31 | hWindowControl1.Size = this.Size;
32 | hWndCtrl = new HWndCtrl(hWindowControl1);
33 | hWndCtrl.ShowMessageEvent += HWndCtrl_ShowMessageEvent;
34 | }
35 | return hWndCtrl;
36 | }
37 | }
38 |
39 | private void HWndCtrl_ShowMessageEvent(object sender, ShowMessageEventArgs e)
40 | {
41 | switch (e.MessageType)
42 | {
43 | case MessageType.MouseMessage:
44 | if (lblMouseMessage.Visible == false)
45 | {
46 | lblMouseMessage.Visible = true;
47 | }
48 | lblMouseMessage.Text = hWndCtrl.MousePosMessage;
49 | break;
50 | case MessageType.ShowOk:
51 | if (labelResult.Visible==false)
52 | {
53 | labelResult.Visible = true;
54 | }
55 | labelResult.BackColor = Color.Green;
56 | labelResult.Text = "OK";
57 | break;
58 | case MessageType.ShowNg:
59 | if (labelResult.Visible == false)
60 | {
61 | labelResult.Visible = true;
62 | }
63 | labelResult.BackColor = Color.Red;
64 | labelResult.Text = "NG";
65 | break;
66 | default:
67 | break;
68 | }
69 | }
70 |
71 | public string CameraMessage
72 | {
73 | get
74 | {
75 | return cameraName;
76 | }
77 | set
78 | {
79 | this.lblName.Text = value;
80 | this.lblName.Visible = true;
81 | cameraName = value;
82 | }
83 | }
84 |
85 | private string ToHexColor(Color color)
86 | {
87 | if (color.IsEmpty)
88 | return "#000000";
89 | string R = Convert.ToString(color.R, 16);
90 | if (R == "0")
91 | R = "00";
92 | string G = Convert.ToString(color.G, 16);
93 | if (G == "0")
94 | G = "00";
95 | string B = Convert.ToString(color.B, 16);
96 | if (B == "0")
97 | B = "00";
98 | string HexColor = "#" + R + G + B;
99 | return HexColor.ToUpper();
100 | }
101 | private void HWndUnit_SizeChanged(object sender, EventArgs e)
102 | {
103 | if (this.DesignMode)
104 | {
105 | return;
106 | }
107 | HWndCtrl.ResetWindow();
108 | hWndCtrl.Repaint();
109 | }
110 |
111 | private void HWndUnit_Load(object sender, EventArgs e)
112 | {
113 | //Wrapper.ShowUnit.ShowHat(hWindowControl1.HalconWindow, true);
114 | }
115 |
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/HWndUnit.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/Mode.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/Mode.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/PictureUnit.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Yoga.ImageControl
2 | {
3 | partial class PictureUnit
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region 组件设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
33 | this.SuspendLayout();
34 | //
35 | // pictureBox1
36 | //
37 | this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
38 | this.pictureBox1.Location = new System.Drawing.Point(0, 0);
39 | this.pictureBox1.Name = "pictureBox1";
40 | this.pictureBox1.Size = new System.Drawing.Size(391, 263);
41 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
42 | this.pictureBox1.TabIndex = 0;
43 | this.pictureBox1.TabStop = false;
44 | //
45 | // PictureUnit
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.Controls.Add(this.pictureBox1);
50 | this.Name = "PictureUnit";
51 | this.Size = new System.Drawing.Size(391, 263);
52 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
53 | this.ResumeLayout(false);
54 |
55 | }
56 |
57 | #endregion
58 |
59 | private System.Windows.Forms.PictureBox pictureBox1;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/PictureUnit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Yoga.ImageControl
12 | {
13 | public partial class PictureUnit : UserControl
14 | {
15 | Bitmap curBitmap;
16 | public PictureUnit()
17 | {
18 | InitializeComponent();
19 | }
20 | public void ShowImage(Image image)
21 | {
22 | pictureBox1.Image = image;
23 | }
24 | public void ShowScreenshots(string savePath)
25 | {
26 | if (curBitmap != null)
27 | {
28 | curBitmap.Dispose();
29 | }
30 | int width = Screen.PrimaryScreen.Bounds.Width;
31 | int height = Screen.PrimaryScreen.Bounds.Height;
32 | curBitmap = new Bitmap(width, height);
33 | using (Graphics g = Graphics.FromImage(curBitmap))
34 | {
35 | g.CopyFromScreen(0, 0, 0, 0, new Size(width, height));
36 | }
37 | pictureBox1.Image = curBitmap;
38 | if (savePath!=string.Empty)
39 | {
40 | System.IO.FileInfo fi = new System.IO.FileInfo(savePath);
41 | if (!fi.Directory.Exists)
42 | {
43 | fi.Directory.Create();
44 | }
45 | curBitmap.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
46 | }
47 | }
48 | public void ShowScreenshots()
49 | {
50 | ShowScreenshots(string.Empty);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/PictureUnit.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("ImageControl")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("HYCONN")]
12 | [assembly: AssemblyProduct("ImageControl")]
13 | [assembly: AssemblyCopyright("Copyright © HYCONN 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("34ddafed-be60-4a7d-b438-c8eb74a3d1f7")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | [assembly: AssemblyVersion("1.1.*")]
35 | //[assembly: AssemblyVersion("1.0.0.0")]
36 | //[assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROI.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/ROI.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROIActUnit.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Yoga.ImageControl
2 | {
3 | partial class ROIActUnit
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region 组件设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.groupBoxCreateROI = new System.Windows.Forms.GroupBox();
32 | this.reduceRect1Button = new System.Windows.Forms.Button();
33 | this.circleButton = new System.Windows.Forms.Button();
34 | this.delROIButton = new System.Windows.Forms.Button();
35 | this.delAllROIButton = new System.Windows.Forms.Button();
36 | this.rect2Button = new System.Windows.Forms.Button();
37 | this.subFromROIButton = new System.Windows.Forms.RadioButton();
38 | this.addToROIButton = new System.Windows.Forms.RadioButton();
39 | this.rect1Button = new System.Windows.Forms.Button();
40 | this.groupBoxCreateROI.SuspendLayout();
41 | this.SuspendLayout();
42 | //
43 | // groupBoxCreateROI
44 | //
45 | this.groupBoxCreateROI.Controls.Add(this.reduceRect1Button);
46 | this.groupBoxCreateROI.Controls.Add(this.circleButton);
47 | this.groupBoxCreateROI.Controls.Add(this.delROIButton);
48 | this.groupBoxCreateROI.Controls.Add(this.delAllROIButton);
49 | this.groupBoxCreateROI.Controls.Add(this.rect2Button);
50 | this.groupBoxCreateROI.Controls.Add(this.subFromROIButton);
51 | this.groupBoxCreateROI.Controls.Add(this.addToROIButton);
52 | this.groupBoxCreateROI.Controls.Add(this.rect1Button);
53 | this.groupBoxCreateROI.Dock = System.Windows.Forms.DockStyle.Fill;
54 | this.groupBoxCreateROI.Location = new System.Drawing.Point(0, 0);
55 | this.groupBoxCreateROI.Name = "groupBoxCreateROI";
56 | this.groupBoxCreateROI.Size = new System.Drawing.Size(202, 155);
57 | this.groupBoxCreateROI.TabIndex = 96;
58 | this.groupBoxCreateROI.TabStop = false;
59 | this.groupBoxCreateROI.Text = "创建ROI";
60 | //
61 | // reduceRect1Button
62 | //
63 | this.reduceRect1Button.Location = new System.Drawing.Point(101, 58);
64 | this.reduceRect1Button.Name = "reduceRect1Button";
65 | this.reduceRect1Button.Size = new System.Drawing.Size(80, 26);
66 | this.reduceRect1Button.TabIndex = 13;
67 | this.reduceRect1Button.Text = "搜索矩形";
68 | this.reduceRect1Button.Click += new System.EventHandler(this.reduceRect1Button_Click);
69 | //
70 | // circleButton
71 | //
72 | this.circleButton.Location = new System.Drawing.Point(6, 117);
73 | this.circleButton.Name = "circleButton";
74 | this.circleButton.Size = new System.Drawing.Size(80, 26);
75 | this.circleButton.TabIndex = 12;
76 | this.circleButton.Text = "圆形";
77 | this.circleButton.Click += new System.EventHandler(this.circleButton_Click);
78 | //
79 | // delROIButton
80 | //
81 | this.delROIButton.Location = new System.Drawing.Point(96, 90);
82 | this.delROIButton.Name = "delROIButton";
83 | this.delROIButton.Size = new System.Drawing.Size(86, 26);
84 | this.delROIButton.TabIndex = 11;
85 | this.delROIButton.Text = "删除激活ROI";
86 | this.delROIButton.Click += new System.EventHandler(this.delROIButton_Click);
87 | //
88 | // delAllROIButton
89 | //
90 | this.delAllROIButton.Location = new System.Drawing.Point(96, 117);
91 | this.delAllROIButton.Name = "delAllROIButton";
92 | this.delAllROIButton.Size = new System.Drawing.Size(86, 26);
93 | this.delAllROIButton.TabIndex = 10;
94 | this.delAllROIButton.Text = "删除所有ROI";
95 | this.delAllROIButton.Click += new System.EventHandler(this.delAllROIButton_Click);
96 | //
97 | // rect2Button
98 | //
99 | this.rect2Button.Location = new System.Drawing.Point(6, 88);
100 | this.rect2Button.Name = "rect2Button";
101 | this.rect2Button.Size = new System.Drawing.Size(80, 26);
102 | this.rect2Button.TabIndex = 9;
103 | this.rect2Button.Text = "带角度矩形";
104 | this.rect2Button.Click += new System.EventHandler(this.rect2Button_Click);
105 | //
106 | // subFromROIButton
107 | //
108 | this.subFromROIButton.Location = new System.Drawing.Point(125, 17);
109 | this.subFromROIButton.Name = "subFromROIButton";
110 | this.subFromROIButton.Size = new System.Drawing.Size(57, 43);
111 | this.subFromROIButton.TabIndex = 8;
112 | this.subFromROIButton.Text = "(-)";
113 | this.subFromROIButton.CheckedChanged += new System.EventHandler(this.subFromROIButton_CheckedChanged);
114 | //
115 | // addToROIButton
116 | //
117 | this.addToROIButton.Checked = true;
118 | this.addToROIButton.Location = new System.Drawing.Point(38, 17);
119 | this.addToROIButton.Name = "addToROIButton";
120 | this.addToROIButton.Size = new System.Drawing.Size(48, 43);
121 | this.addToROIButton.TabIndex = 7;
122 | this.addToROIButton.TabStop = true;
123 | this.addToROIButton.Text = "(+)";
124 | this.addToROIButton.CheckedChanged += new System.EventHandler(this.addToROIButton_CheckedChanged);
125 | //
126 | // rect1Button
127 | //
128 | this.rect1Button.Location = new System.Drawing.Point(6, 59);
129 | this.rect1Button.Name = "rect1Button";
130 | this.rect1Button.Size = new System.Drawing.Size(80, 26);
131 | this.rect1Button.TabIndex = 5;
132 | this.rect1Button.Text = "矩形";
133 | this.rect1Button.Click += new System.EventHandler(this.rect1Button_Click);
134 | //
135 | // ROIActUnit
136 | //
137 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
138 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
139 | this.Controls.Add(this.groupBoxCreateROI);
140 | this.Name = "ROIActUnit";
141 | this.Size = new System.Drawing.Size(202, 155);
142 | this.groupBoxCreateROI.ResumeLayout(false);
143 | this.ResumeLayout(false);
144 |
145 | }
146 |
147 | #endregion
148 |
149 | private System.Windows.Forms.GroupBox groupBoxCreateROI;
150 | private System.Windows.Forms.Button reduceRect1Button;
151 | private System.Windows.Forms.Button circleButton;
152 | private System.Windows.Forms.Button delROIButton;
153 | private System.Windows.Forms.Button delAllROIButton;
154 | private System.Windows.Forms.Button rect2Button;
155 | private System.Windows.Forms.RadioButton subFromROIButton;
156 | private System.Windows.Forms.RadioButton addToROIButton;
157 | private System.Windows.Forms.Button rect1Button;
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROIActUnit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Yoga.ImageControl
12 | {
13 | public partial class ROIActUnit : UserControl
14 | {
15 | private ROIController roiController;
16 | private bool useSearchRoi=true;
17 | public ROIActUnit()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | public ROIController RoiController
23 | {
24 | get
25 | {
26 | return roiController;
27 | }
28 |
29 | set
30 | {
31 | roiController = value;
32 | }
33 | }
34 |
35 | public bool UseSearchRoi
36 | {
37 | get
38 | {
39 | return useSearchRoi;
40 | }
41 |
42 | set
43 | {
44 | useSearchRoi = value;
45 | reduceRect1Button.Visible = useSearchRoi;
46 | }
47 | }
48 |
49 | private void addToROIButton_CheckedChanged(object sender, EventArgs e)
50 | {
51 | if (addToROIButton.Checked)
52 | RoiController.SetROISign(ROIOperation.Positive);
53 | }
54 |
55 | private void subFromROIButton_CheckedChanged(object sender, EventArgs e)
56 | {
57 | if (subFromROIButton.Checked)
58 | RoiController.SetROISign(ROIOperation.Negative);
59 | }
60 |
61 | private void rect1Button_Click(object sender, EventArgs e)
62 | {
63 | RoiController.SetROIShape(new ROIRectangle1());
64 | }
65 |
66 | private void rect2Button_Click(object sender, EventArgs e)
67 | {
68 | RoiController.SetROIShape(new ROIRectangle2());
69 | }
70 |
71 | private void circleButton_Click(object sender, EventArgs e)
72 | {
73 | RoiController.SetROIShape(new ROICircle());
74 | }
75 |
76 | private void reduceRect1Button_Click(object sender, EventArgs e)
77 | {
78 | RoiController.SetROIShapeNoOperator(new ROIRectangle2("搜索区域"));
79 | }
80 |
81 | private void delROIButton_Click(object sender, EventArgs e)
82 | {
83 | RoiController.RemoveActive();
84 | }
85 |
86 | private void delAllROIButton_Click(object sender, EventArgs e)
87 | {
88 | RoiController.Reset();
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROIActUnit.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROICircle.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/ROICircle.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROICircularArc.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/ROICircularArc.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROIController.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/ROIController.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROIEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*********************************************************************************************************
3 | *
4 | * 说明:
5 | *
6 | * halcon图像显示控件的再次封装
7 | * 20180621
8 | * 1.对于图像显示及其他操作全部封装到c++代码中避免c#对于hobject对象释放导致显示异常问题
9 | * 2.c++ cli代理对于其他自定义算法也可以按照此模式添加
10 | * 3.roi操作参考的是halcon官方实例
11 | * 4.c++代码用到了qt5
12 | * 5.开发环境为vs2015+halcon13+qt5.9.1
13 | *
14 | * 作者:林玉刚 有任何疑问或建议请联系 linyugang@foxmail.com
15 | *
16 | *********************************************************************************************************/
17 |
18 | namespace Yoga.ImageControl
19 | {
20 | ///
21 | /// 显示引发事件
22 | ///
23 | public class ViewEventArgs : EventArgs
24 | {
25 | public readonly ViewMessage ViewMessage;
26 | public ViewEventArgs(ViewMessage viewMessage)
27 | {
28 | this.ViewMessage = viewMessage;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROILine.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/ROILine.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROIRectangle1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/ROIRectangle1.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/ROIRectangle2.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.ImageControl/ROIRectangle2.cs
--------------------------------------------------------------------------------
/Yoga.ImageControl/ShowMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | /*********************************************************************************************************
7 | *
8 | * 说明:
9 | *
10 | * halcon图像显示控件的再次封装
11 | * 20180621
12 | * 1.对于图像显示及其他操作全部封装到c++代码中避免c#对于hobject对象释放导致显示异常问题
13 | * 2.c++ cli代理对于其他自定义算法也可以按照此模式添加
14 | * 3.roi操作参考的是halcon官方实例
15 | * 4.c++代码用到了qt5
16 | * 5.开发环境为vs2015+halcon13+qt5.9.1
17 | *
18 | * 作者:林玉刚 有任何疑问或建议请联系 linyugang@foxmail.com
19 | *
20 | *********************************************************************************************************/
21 |
22 | namespace Yoga.ImageControl
23 | {
24 | public enum MessageType
25 | {
26 | MouseMessage,
27 | ShowOk,
28 | ShowNg
29 | }
30 | public class ShowMessageEventArgs
31 | {
32 | public readonly MessageType MessageType;
33 | public readonly string message;
34 | public ShowMessageEventArgs(MessageType messageType)
35 | {
36 | this.MessageType = messageType;
37 | }
38 | public ShowMessageEventArgs(string message)
39 | {
40 | this.MessageType = MessageType.MouseMessage;
41 | this.message = message;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Yoga.ImageControl/Yoga.ImageControl.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {34DDAFED-BE60-4A7D-B438-C8EB74A3D1F7}
8 | Library
9 | Properties
10 | Yoga.ImageControl
11 | Yoga.ImageControl
12 | v4.5.2
13 | 512
14 |
15 |
16 | true
17 | ..\..\bin\x64\Debug\
18 | DEBUG;TRACE
19 | full
20 | x64
21 | prompt
22 | MinimumRecommendedRules.ruleset
23 |
24 |
25 | ..\..\bin\x64\Release\
26 | TRACE
27 | true
28 | pdbonly
29 | x64
30 | prompt
31 | MinimumRecommendedRules.ruleset
32 |
33 |
34 | true
35 | ..\..\bin\x86\Debug\
36 | DEBUG;TRACE
37 | full
38 | x86
39 | prompt
40 | MinimumRecommendedRules.ruleset
41 |
42 |
43 | ..\..\bin\x86\Release\
44 | TRACE
45 | true
46 | pdbonly
47 | x86
48 | prompt
49 | MinimumRecommendedRules.ruleset
50 |
51 |
52 |
53 | ..\..\..\..\..\..\Program Files\MVTec\HALCON-13.0\bin\dotnet35\halcondotnet.dll
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | UserControl
71 |
72 |
73 | FunctionPlotUnit.cs
74 |
75 |
76 |
77 |
78 |
79 |
80 | UserControl
81 |
82 |
83 | HWndUnit.cs
84 |
85 |
86 |
87 | UserControl
88 |
89 |
90 | PictureUnit.cs
91 |
92 |
93 |
94 |
95 | UserControl
96 |
97 |
98 | ROIActUnit.cs
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 | {b1ab93b2-0cf1-4580-a799-7761bfe7371e}
112 | Yoga.Wrapper
113 |
114 |
115 |
116 |
117 | FunctionPlotUnit.cs
118 |
119 |
120 | HWndUnit.cs
121 |
122 |
123 | PictureUnit.cs
124 |
125 |
126 | ROIActUnit.cs
127 |
128 |
129 |
130 |
137 |
--------------------------------------------------------------------------------
/Yoga.Native/GraphicsContext.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/GraphicsContext.cpp
--------------------------------------------------------------------------------
/Yoga.Native/GraphicsContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "HalconCpp.h"
3 | #include
4 | #include
5 | #include
6 | class GraphicsContext
7 | {
8 | public:
9 | static QString GC_COLOR;
10 | static QString GC_COLORED;
11 | static QString GC_LINEWIDTH;
12 | static QString GC_DRAWMODE;
13 | static QString GC_SHAPE;
14 | static QString GC_LUT;
15 | static QString GC_PAINT;
16 | static QString GC_LINESTYLE;
17 | QHash graphicalSettings;
18 | QHash stateOfSettings;
19 |
20 | GraphicsContext();
21 | void applyContext(const HalconCpp::HTuple &winID, const QHash &cContext);
22 | void setAttribute(const QString &key, const HalconCpp::HTuple &val);
23 | };
24 |
25 |
--------------------------------------------------------------------------------
/Yoga.Native/HObjectEntry.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "HObjectEntry.h"
3 |
4 | HObjectEntry::HObjectEntry(const HalconCpp::HObject & obj, const QHash& gc)
5 | {
6 | this->gc = gc;
7 | this->hobj = obj;
8 | }
9 |
10 | HObjectEntry::HObjectEntry(const HWndMessage & message)
11 | {
12 | this->message = message;
13 | }
14 |
15 | HObjectEntry::~HObjectEntry()
16 | {
17 | }
18 |
19 | QHash HObjectEntry::getGC() const
20 | {
21 | return gc;
22 | }
23 |
24 |
25 | HalconCpp::HObject HObjectEntry::getHobj() const
26 | {
27 | return hobj;
28 | }
29 |
30 | HWndMessage HObjectEntry::getMessage() const
31 | {
32 | return message;
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/Yoga.Native/HObjectEntry.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "qstring.h"
3 | #include "HalconCpp.h"
4 | #include "HWndMessage.h"
5 | #include
6 | #include
7 | using namespace std;
8 | class HObjectEntry
9 | {
10 | public:
11 | HObjectEntry(const HalconCpp::HObject &obj, const QHash &gc);
12 | HObjectEntry(const HWndMessage &message);
13 | ~HObjectEntry();
14 | QHash getGC() const;
15 | HalconCpp::HObject getHobj() const;
16 |
17 | HWndMessage getMessage() const;
18 |
19 | private:
20 | QHash gc;
21 | HalconCpp::HObject hobj;
22 | HWndMessage message;
23 | };
24 |
25 |
--------------------------------------------------------------------------------
/Yoga.Native/HWndMessage.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/HWndMessage.cpp
--------------------------------------------------------------------------------
/Yoga.Native/HWndMessage.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | # include "HalconCpp.h"
3 | #include
4 | class HWndMessage
5 | {
6 | public:
7 | HWndMessage();
8 | HWndMessage(HalconCpp::HTuple message, int row, int colunm, int size, HalconCpp::HTuple color);
9 | HWndMessage(HalconCpp::HTuple message, int row, int colunm);
10 | ~HWndMessage();
11 | double dispMessage(HalconCpp::HTuple winID, QString coordSystem, double zoom,double currentSize);
12 | void dispMessage(HalconCpp::HTuple winID, QString coordSystem, double zoom);
13 | bool IsInitialized() const;
14 | HWndMessage clone() const;
15 | private:
16 | HalconCpp::HTuple message;
17 | int size = 16;
18 | int row;
19 | int colunm;
20 | HalconCpp::HTuple color = "green";
21 | bool isInitialized;
22 | void dispMessage(HalconCpp::HTuple hv_WindowHandle, HalconCpp::HTuple hv_String, HalconCpp::HTuple hv_CoordSystem,
23 | HalconCpp::HTuple hv_Row, HalconCpp::HTuple hv_Column, HalconCpp::HTuple hv_Color, HalconCpp::HTuple hv_Box);
24 | void setDisplayFont(HalconCpp::HTuple hv_WindowHandle, HalconCpp::HTuple hv_Size, HalconCpp::HTuple hv_Font, HalconCpp::HTuple hv_Bold,
25 | HalconCpp::HTuple hv_Slant);
26 |
27 | };
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Yoga.Native/NativeShowUnit.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/NativeShowUnit.cpp
--------------------------------------------------------------------------------
/Yoga.Native/NativeShowUnit.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "HalconCpp.h"
4 | #include"HObjectEntry.h"
5 | class __declspec(dllexport) NativeShowUnit
6 | {
7 | public:
8 | static void AddIconicVar(const HalconCpp::HTuple& winID, const HalconCpp::HImage& img);
9 | static void AddIconicVar(const HalconCpp::HTuple& winID, const HalconCpp::HObject& obj);
10 |
11 | static void ShowText(const HalconCpp::HTuple& winID, const HalconCpp::HTuple& message, int row, int colunm, int size, const HalconCpp::HTuple& color, const HalconCpp::HTuple & coordSystem);
12 | static void AddText(const HalconCpp::HTuple& winID, const HalconCpp::HTuple& message, int row, int colunm, int size, const HalconCpp::HTuple& color);
13 | static void AddText(const HalconCpp::HTuple& winID, const HalconCpp::HTuple& message, int row, int colunm);
14 |
15 |
16 | static void ClearWindowData(const HalconCpp::HTuple& winID);
17 | static void ClearEntryList(const HalconCpp::HTuple& winID);
18 | static void Refresh(const HalconCpp::HTuple& winID, bool showImageOnly, bool isShowText, double scale);
19 | static void SaveImage(const HalconCpp::HTuple& winID, const HalconCpp::HTuple& path);
20 | static bool IsEmpty(const HalconCpp::HTuple& winID);
21 | static void ChangeGraphicSettings(const HalconCpp::HTuple& winID, const HalconCpp::HTuple& mode, const HalconCpp::HTuple& val);
22 |
23 | static void SetImageSize(const HalconCpp::HTuple & winID, double imageWidth, double imageHeight);
24 | static void SetBackgroundColor(const HalconCpp::HTuple & winID, const HalconCpp::HTuple & color);
25 | static void ShowHat(const HalconCpp::HTuple& winID, bool isShowCross);
26 | static std::string GetPixMessage(const HalconCpp::HTuple& winID, HalconCpp::HTuple *currX, HalconCpp::HTuple*currY);
27 | static HalconCpp::HTuple GetGrayHisto(const HalconCpp::HTuple& winID, const HalconCpp::HTuple& rectangle1);
28 | private:
29 | static void addEntry(const HalconCpp::HTuple & winID, const HObjectEntry & entry);
30 | };
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Yoga.Native/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | 动态链接库:Yoga.Native 项目概述
3 | ========================================================================
4 |
5 | 应用程序向导已为您创建了此 Yoga.Native DLL。
6 |
7 | 本文件概要介绍组成 Yoga.Native 应用程序的每个文件的内容。
8 |
9 |
10 | Yoga.Native.vcxproj
11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
12 |
13 | Yoga.Native.vcxproj.filters
14 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
15 |
16 | Yoga.Native.cpp
17 | 这是主 DLL 源文件。
18 |
19 | /////////////////////////////////////////////////////////////////////////////
20 | 其他标准文件:
21 |
22 | StdAfx.h, StdAfx.cpp
23 | 这些文件用于生成名为 Yoga.Native.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
24 |
25 | /////////////////////////////////////////////////////////////////////////////
26 | 其他注释:
27 |
28 | 应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。
29 |
30 | /////////////////////////////////////////////////////////////////////////////
31 |
--------------------------------------------------------------------------------
/Yoga.Native/Util.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "Util.h"
3 | EventCallback Util::ms_callback = 0;
4 | Util::Util()
5 | {
6 | }
7 |
8 |
9 | Util::~Util()
10 | {
11 | }
12 | void Util::RegisterCallback(EventCallback callback)
13 | {
14 | //assert(0 != callback);
15 | ms_callback = callback;
16 | }
17 |
18 | void Util::Invoke(char* msg)
19 | {
20 | //assert(0 != ms_callback);
21 | if (0 != ms_callback)
22 | {
23 | ms_callback(msg);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Yoga.Native/Util.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/Util.h
--------------------------------------------------------------------------------
/Yoga.Native/Yoga.Native.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/Yoga.Native.cpp
--------------------------------------------------------------------------------
/Yoga.Native/Yoga.Native.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/Yoga.Native.h
--------------------------------------------------------------------------------
/Yoga.Native/Yoga.Native.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 | {60B76454-1570-423C-AEC6-3B522B023633}
23 | Win32Proj
24 | YogaNative
25 | 8.1
26 |
27 |
28 |
29 | DynamicLibrary
30 | true
31 | v140
32 | Unicode
33 |
34 |
35 | DynamicLibrary
36 | false
37 | v140
38 | true
39 | Unicode
40 |
41 |
42 | DynamicLibrary
43 | true
44 | v140
45 | Unicode
46 |
47 |
48 | DynamicLibrary
49 | false
50 | v140
51 | true
52 | Unicode
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | true
74 | $(SolutionDir)..\bin\x86\$(Configuration)\
75 |
76 |
77 | true
78 |
79 |
80 | false
81 | $(SolutionDir)..\bin\x86\$(Configuration)\
82 |
83 |
84 | false
85 | $(SolutionDir)\..\bin\x64\$(Configuration)\
86 |
87 |
88 |
89 | Use
90 | Level3
91 | Disabled
92 | WIN32;_DEBUG;_WINDOWS;_USRDLL;YOGANATIVE_EXPORTS;%(PreprocessorDefinitions)
93 | true
94 | $(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include\QtCore;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include
95 | true
96 |
97 |
98 | Windows
99 | true
100 | C:\Qt\Qt5.9.1\5.9.1\msvc2015\lib;$(HALCONROOT)\lib\x86sse2-win32
101 | Qt5Core.lib;halconcpp.lib;%(AdditionalDependencies)
102 |
103 |
104 |
105 |
106 | Use
107 | Level3
108 | Disabled
109 | _DEBUG;_WINDOWS;_USRDLL;YOGANATIVE_EXPORTS;%(PreprocessorDefinitions)
110 | true
111 |
112 |
113 | Windows
114 | true
115 |
116 |
117 |
118 |
119 | Level3
120 | Use
121 | MaxSpeed
122 | true
123 | true
124 | WIN32;NDEBUG;_WINDOWS;_USRDLL;YOGANATIVE_EXPORTS;%(PreprocessorDefinitions)
125 | true
126 | $(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include\QtCore;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include
127 |
128 |
129 | Windows
130 | true
131 | true
132 | true
133 | C:\Qt\Qt5.9.1\5.9.1\msvc2015\lib;$(HALCONROOT)\lib\x86sse2-win32
134 | Qt5Core.lib;halconcpp.lib;%(AdditionalDependencies)
135 |
136 |
137 |
138 |
139 | Level3
140 | Use
141 | MaxSpeed
142 | true
143 | true
144 | NDEBUG;_WINDOWS;_USRDLL;YOGANATIVE_EXPORTS;%(PreprocessorDefinitions)
145 | true
146 | $(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;C:\Qt\Qt5.9.1\5.9.1\msvc2015_64\include\QtCore;C:\Qt\Qt5.9.1\5.9.1\msvc2015_64\include
147 | true
148 |
149 |
150 | Windows
151 | true
152 | true
153 | true
154 | Qt5Core.lib;halconcpp.lib;%(AdditionalDependencies)
155 | C:\Qt\Qt5.9.1\5.9.1\msvc2015_64\lib;$(HALCONROOT)\lib\x64-win64;%(AdditionalLibraryDirectories)
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 | false
174 |
175 |
176 | false
177 |
178 |
179 | false
180 |
181 |
182 | false
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 | Create
192 | Create
193 | Create
194 | Create
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
--------------------------------------------------------------------------------
/Yoga.Native/Yoga.Native.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;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 |
--------------------------------------------------------------------------------
/Yoga.Native/dllmain.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/dllmain.cpp
--------------------------------------------------------------------------------
/Yoga.Native/stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/stdafx.cpp
--------------------------------------------------------------------------------
/Yoga.Native/stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/stdafx.h
--------------------------------------------------------------------------------
/Yoga.Native/targetver.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Native/targetver.h
--------------------------------------------------------------------------------
/Yoga.Test/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Yoga.Test/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Yoga.Test
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.hWndUnit1 = new Yoga.ImageControl.HWndUnit();
32 | this.roiActUnit1 = new Yoga.ImageControl.ROIActUnit();
33 | this.SuspendLayout();
34 | //
35 | // hWndUnit1
36 | //
37 | this.hWndUnit1.BackColor = System.Drawing.SystemColors.Control;
38 | this.hWndUnit1.CameraMessage = null;
39 | this.hWndUnit1.Location = new System.Drawing.Point(23, 120);
40 | this.hWndUnit1.MinimumSize = new System.Drawing.Size(10, 10);
41 | this.hWndUnit1.Name = "hWndUnit1";
42 | this.hWndUnit1.Size = new System.Drawing.Size(311, 305);
43 | this.hWndUnit1.TabIndex = 0;
44 | //
45 | // roiActUnit1
46 | //
47 | this.roiActUnit1.Location = new System.Drawing.Point(376, 218);
48 | this.roiActUnit1.Name = "roiActUnit1";
49 | this.roiActUnit1.RoiController = null;
50 | this.roiActUnit1.Size = new System.Drawing.Size(202, 155);
51 | this.roiActUnit1.TabIndex = 1;
52 | this.roiActUnit1.UseSearchRoi = true;
53 | //
54 | // Form1
55 | //
56 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
57 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
58 | this.ClientSize = new System.Drawing.Size(622, 437);
59 | this.Controls.Add(this.roiActUnit1);
60 | this.Controls.Add(this.hWndUnit1);
61 | this.Name = "Form1";
62 | this.Text = "Form1";
63 | this.Load += new System.EventHandler(this.Form1_Load);
64 | this.ResumeLayout(false);
65 |
66 | }
67 |
68 | #endregion
69 |
70 | private ImageControl.HWndUnit hWndUnit1;
71 | private ImageControl.ROIActUnit roiActUnit1;
72 | }
73 | }
--------------------------------------------------------------------------------
/Yoga.Test/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using Yoga.ImageControl;
11 | using HalconDotNet;
12 | namespace Yoga.Test
13 | {
14 | public partial class Form1 : Form
15 | {
16 | /// halcon窗体控制
17 | private HWndCtrl hWndCrtl;
18 | /// ROI 管理控制
19 | public ROIController ROIController;
20 |
21 | public Form1()
22 | {
23 | InitializeComponent();
24 | hWndCrtl = hWndUnit1.HWndCtrl;
25 |
26 | ROIController = new ROIController();
27 |
28 | ROIController.ROINotifyEvent += new EventHandler(UpdateViewData);
29 | roiActUnit1.RoiController = ROIController;
30 | hWndCrtl.useROIController(ROIController);
31 |
32 | ROIController.SetROISign(ROIOperation.Positive);
33 |
34 | }
35 |
36 | private void UpdateViewData(object sender, ViewEventArgs e)
37 | {
38 | //throw new NotImplementedException();
39 | }
40 |
41 | private void Form1_Load(object sender, EventArgs e)
42 | {
43 | HImage img = new HImage(@"D:\12.bmp");
44 | hWndCrtl.AddIconicVar(img);
45 | hWndCrtl.AddText("测试",20,20);
46 | hWndCrtl.Repaint();
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Yoga.Test/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Yoga.Test/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace Yoga.Test
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 应用程序的主入口点。
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Yoga.Test/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("Yoga.Test")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("Yoga.Test")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("1355b3e1-5b2d-4804-9cc4-ca2a7b2887c1")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Yoga.Test/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Yoga.Test.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Yoga.Test.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Yoga.Test/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Yoga.Test/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Yoga.Test.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Yoga.Test/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Yoga.Test/Yoga.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {1355B3E1-5B2D-4804-9CC4-CA2A7B2887C1}
8 | WinExe
9 | Properties
10 | Yoga.Test
11 | Yoga.Test
12 | v4.5.2
13 | 512
14 | true
15 |
16 |
17 | true
18 | bin\x64\Debug\
19 | DEBUG;TRACE
20 | full
21 | x64
22 | prompt
23 | MinimumRecommendedRules.ruleset
24 | true
25 |
26 |
27 | bin\x64\Release\
28 | TRACE
29 | true
30 | pdbonly
31 | x64
32 | prompt
33 | MinimumRecommendedRules.ruleset
34 | true
35 |
36 |
37 | true
38 | ..\..\bin\x86\Debug\
39 | DEBUG;TRACE
40 | full
41 | x86
42 | prompt
43 | MinimumRecommendedRules.ruleset
44 | true
45 |
46 |
47 | bin\x86\Release\
48 | TRACE
49 | true
50 | pdbonly
51 | x86
52 | prompt
53 | MinimumRecommendedRules.ruleset
54 | true
55 |
56 |
57 |
58 | False
59 | ..\..\..\..\..\..\Program Files\MVTec\HALCON-13.0\bin\dotnet35\halcondotnet.dll
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | Form
79 |
80 |
81 | Form1.cs
82 |
83 |
84 |
85 |
86 | Form1.cs
87 |
88 |
89 | ResXFileCodeGenerator
90 | Resources.Designer.cs
91 | Designer
92 |
93 |
94 | True
95 | Resources.resx
96 |
97 |
98 | SettingsSingleFileGenerator
99 | Settings.Designer.cs
100 |
101 |
102 | True
103 | Settings.settings
104 | True
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 | {34ddafed-be60-4a7d-b438-c8eb74a3d1f7}
113 | Yoga.ImageControl
114 |
115 |
116 |
117 |
124 |
--------------------------------------------------------------------------------
/Yoga.Wrapper/AssemblyInfo.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Wrapper/AssemblyInfo.cpp
--------------------------------------------------------------------------------
/Yoga.Wrapper/Conversion.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "Conversion.h"
3 |
4 | using namespace System::Runtime::InteropServices;
5 | #include
6 | using namespace msclr::interop;
7 | // Conversions from HALCON/.NET to HALCON/C++
8 |
9 | HalconCpp::HObject Conversion::ObjectToNative(HObject^ object)
10 | {
11 | if (object == nullptr)
12 | {
13 | return HalconCpp::HObject();
14 | }
15 | return HalconCpp::HObject(KeyToNative(object->Key), TRUE);
16 | }
17 |
18 | HalconCpp::HImage Conversion::ImageToNative(HImage^ image)
19 | {
20 | if (image==nullptr)
21 | {
22 | return HalconCpp::HImage();
23 | }
24 | return HalconCpp::HImage(KeyToNative(image->Key));
25 | }
26 |
27 | HalconCpp::HRegion Conversion::RegionToNative(HRegion^ region)
28 | {
29 | System::Object^tmp = nullptr;
30 | if (region == tmp)
31 | {
32 | return HalconCpp::HRegion();
33 | }
34 | return HalconCpp::HRegion(KeyToNative(region->Key));
35 | }
36 |
37 | HalconCpp::HXLD Conversion::XLDToNative(HXLD^ xld)
38 | {
39 | if (xld == nullptr)
40 | {
41 | return HalconCpp::HXLD();
42 | }
43 | return HalconCpp::HXLD(KeyToNative(xld->Key));
44 | }
45 |
46 | HalconCpp::HTuple Conversion::TupleToNative(HTuple^ tuple)
47 | {
48 | System::Object^tmp = nullptr;
49 | if (tuple == tmp)
50 | {
51 | return HalconCpp::HTuple();
52 | }
53 | HalconCpp::HTuple result(tuple->Length, 0.0);
54 |
55 | for (int i = 0; i < tuple->Length; i++)
56 | {
57 | switch (tuple[i]->Type)
58 | {
59 | case HTupleType::INTEGER:
60 | case HTupleType::LONG:
61 | result[i] = (Hlong)tuple[i]->IP.ToPointer();
62 | break;
63 | case HTupleType::DOUBLE:
64 | result[i] = tuple[i]->D;
65 | break;
66 | case HTupleType::STRING:
67 | result[i] = (char*)Marshal::StringToHGlobalAnsi(tuple[i]->S).ToPointer();
68 | break;
69 | }
70 | }
71 |
72 | return result;
73 | }
74 |
75 |
76 |
77 | // Conversions from HALCON/C++ to HALCON/.NET
78 |
79 | HObject^ Conversion::ObjectToManaged(const HalconCpp::HObject& object)
80 | {
81 | return gcnew HObject(KeyToManaged(object.Key()), true);
82 | }
83 |
84 | HImage^ Conversion::ImageToManaged(const HalconCpp::HImage& image)
85 | {
86 | return gcnew HImage(KeyToManaged(image.Key()), true);
87 | }
88 |
89 | HRegion^ Conversion::RegionToManaged(const HalconCpp::HRegion& region)
90 | {
91 | return gcnew HRegion(KeyToManaged(region.Key()), true);
92 | }
93 |
94 | HXLD^ Conversion::XLDToManaged(const HalconCpp::HXLD& xld)
95 | {
96 | return gcnew HXLD(KeyToManaged(xld.Key()), true);
97 | }
98 |
99 | HXLDCont ^ Conversion::HXLDContToManaged(const HalconCpp::HXLDCont & xld)
100 | {
101 | return gcnew HXLDCont(KeyToManaged(xld.Key()), true);
102 | }
103 |
104 | HTuple^ Conversion::TupleToManaged(const HalconCpp::HTuple& tuple)
105 | {
106 | // This is not optimized but data transfer between language
107 | // interfaces should also not occur very frequently.
108 |
109 | HTuple^ result = HTuple::TupleGenConst(tuple.Length(), 0.0);
110 | //HTuple^ result = gcnew HTuple();
111 | for (int i = 0; i < tuple.Length(); i++)
112 | {
113 | switch (tuple[i].Type())
114 | {
115 | case LONG_PAR:
116 | result[i]->IP = System::IntPtr((void*)tuple[i].L());
117 | break;
118 | case DOUBLE_PAR:
119 | result[i]->D = tuple[i].D();
120 | break;
121 | case STRING_PAR:
122 | result[i]->S = gcnew System::String(tuple[i].S());
123 | break;
124 | }
125 | }
126 |
127 | return result;
128 | }
129 |
130 | System::String ^ Conversion::StringToManged(const std::string & string)
131 | {
132 | System::String^ result = marshal_as(string);
133 | return result;
134 | }
135 |
136 |
137 | // Support functionality for implementing the conversions
138 |
139 | System::IntPtr Conversion::KeyToManaged(Hkey key)
140 | {
141 | return System::IntPtr((void*)key);
142 | }
143 |
144 | Hkey Conversion::KeyToNative(System::IntPtr handle)
145 | {
146 | return (Hkey)handle.ToPointer();
147 | }
148 |
--------------------------------------------------------------------------------
/Yoga.Wrapper/Conversion.h:
--------------------------------------------------------------------------------
1 | // Data conversion between HALCON/C++ and HALCON/.NET objects
2 | //
3 | // This class can be reused as is for your own interoperating project
4 |
5 | #pragma once
6 |
7 | #include "HalconCpp.h"
8 | // Due to identical class names in C++ and .NET, we only
9 | // declare the namespace for HALCON/.NET and use all C++
10 | // classes with the fully qualified name (HalconCpp::X)
11 | using namespace HalconDotNet;
12 |
13 | class Conversion
14 | {
15 | public:
16 |
17 | // Conversions from HALCON/.NET to HALCON/C++
18 | static HalconCpp::HObject ObjectToNative(HObject^ object);
19 | static HalconCpp::HImage ImageToNative(HImage^ image);
20 | static HalconCpp::HRegion RegionToNative(HRegion^ region);
21 | static HalconCpp::HXLD XLDToNative(HXLD^ xld);
22 | static HalconCpp::HTuple TupleToNative(HTuple^ tuple);
23 |
24 | // Conversions from HALCON/C++ to HALCON/.NET
25 | static HObject^ ObjectToManaged(const HalconCpp::HObject& object);
26 | static HImage^ ImageToManaged(const HalconCpp::HImage& image);
27 | static HRegion^ RegionToManaged(const HalconCpp::HRegion& region);
28 | static HXLD^ XLDToManaged(const HalconCpp::HXLD& xld);
29 | static HXLDCont^ HXLDContToManaged(const HalconCpp::HXLDCont& xld);
30 | static HTuple^ TupleToManaged(const HalconCpp::HTuple& tuple);
31 | static System::String^ StringToManged(const std::string& string);
32 | private:
33 |
34 | // Support functionality for implementing the conversions
35 | static System::IntPtr KeyToManaged(Hkey key);
36 | static Hkey KeyToNative(System::IntPtr handle);
37 | };
38 |
--------------------------------------------------------------------------------
/Yoga.Wrapper/NativeTest.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "NativeTest.h"
3 |
4 | using namespace HalconCpp;
5 | NativeTest::NativeTest()
6 | {
7 | }
8 |
9 |
10 | NativeTest::~NativeTest()
11 | {
12 | }
13 |
--------------------------------------------------------------------------------
/Yoga.Wrapper/NativeTest.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "HalconCpp.h"
3 |
4 | class NativeTest
5 | {
6 | public:
7 | NativeTest();
8 | ~NativeTest();
9 |
10 | };
11 |
12 |
--------------------------------------------------------------------------------
/Yoga.Wrapper/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | DYNAMIC LINK LIBRARY : Wrapper Project Overview
3 | ========================================================================
4 |
5 | AppWizard has created this Wrapper DLL for you.
6 |
7 | This file contains a summary of what you will find in each of the files that
8 | make up your Wrapper application.
9 |
10 | Wrapper.vcxproj
11 | This is the main project file for VC++ projects generated using an Application Wizard.
12 | It contains information about the version of Visual C++ that generated the file, and
13 | information about the platforms, configurations, and project features selected with the
14 | Application Wizard.
15 |
16 | Wrapper.vcxproj.filters
17 | This is the filters file for VC++ projects generated using an Application Wizard.
18 | It contains information about the association between the files in your project
19 | and the filters. This association is used in the IDE to show grouping of files with
20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the
21 | "Source Files" filter).
22 |
23 | Wrapper.cpp
24 | This is the main DLL source file.
25 |
26 | Wrapper.h
27 | This file contains a class declaration.
28 |
29 | AssemblyInfo.cpp
30 | Contains custom attributes for modifying assembly metadata.
31 |
32 | /////////////////////////////////////////////////////////////////////////////
33 | Other notes:
34 |
35 | AppWizard uses "TODO:" to indicate parts of the source code you
36 | should add to or customize.
37 |
38 | /////////////////////////////////////////////////////////////////////////////
39 |
--------------------------------------------------------------------------------
/Yoga.Wrapper/ShowUnit.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | #include "ShowUnit.h"
5 | #include"NativeShowUnit.h"
6 | void Yoga::Wrapper::ShowUnit::AddIconicVar(HTuple ^ winID, HImage ^ img)
7 | {
8 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
9 | HalconCpp::HImage n_img = Conversion::ImageToNative(img);
10 | NativeShowUnit::AddIconicVar(n_winID, n_img);
11 | }
12 | void Yoga::Wrapper::ShowUnit::AddIconicVar(HTuple ^ winID, HObject ^ obj)
13 | {
14 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
15 | HalconCpp::HObject n_obj = Conversion::ObjectToNative(obj);
16 | NativeShowUnit::AddIconicVar(n_winID, n_obj);
17 | }
18 |
19 | void Yoga::Wrapper::ShowUnit::ShowText(HTuple ^ winID, HTuple ^ message, int row, int colunm, int size, HTuple ^ color, HTuple^ coordSystem)
20 | {
21 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
22 | HalconCpp::HTuple n_message = Conversion::TupleToNative(message);
23 | HalconCpp::HTuple n_color = Conversion::TupleToNative(color);
24 | HalconCpp::HTuple n_coordSystem = Conversion::TupleToNative(coordSystem);
25 | NativeShowUnit::ShowText(n_winID, n_message, row, colunm, size, n_color, n_coordSystem);
26 | }
27 |
28 | void Yoga::Wrapper::ShowUnit::AddText(HTuple ^ winID, HTuple ^ message, int row, int colunm, int size, HTuple ^ color)
29 | {
30 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
31 | HalconCpp::HTuple n_message = Conversion::TupleToNative(message);
32 | HalconCpp::HTuple n_color = Conversion::TupleToNative(color);
33 | NativeShowUnit::AddText(n_winID, n_message, row, colunm, size, n_color);
34 | }
35 |
36 | void Yoga::Wrapper::ShowUnit::AddText(HTuple ^ winID, HTuple ^ message, int row, int colunm)
37 | {
38 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
39 | HalconCpp::HTuple n_message = Conversion::TupleToNative(message);
40 | NativeShowUnit::AddText(n_winID, n_message, row, colunm);
41 | }
42 |
43 | void Yoga::Wrapper::ShowUnit::ClearWindowData(HTuple ^ winID)
44 | {
45 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
46 | NativeShowUnit::ClearWindowData(n_winID);
47 | }
48 |
49 | void Yoga::Wrapper::ShowUnit::ClearEntryList(HTuple ^ winID)
50 | {
51 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
52 | NativeShowUnit::ClearEntryList(n_winID);
53 | }
54 |
55 | void Yoga::Wrapper::ShowUnit::Refresh(HTuple ^ winID, bool showImageOnly, bool isShowText, double scale)
56 | {
57 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
58 | NativeShowUnit::Refresh(n_winID, showImageOnly, isShowText, scale);
59 | }
60 |
61 | void Yoga::Wrapper::ShowUnit::SaveImage(HTuple ^ winID, HTuple ^ path)
62 | {
63 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
64 | HalconCpp::HTuple n_path = Conversion::TupleToNative(path);
65 | NativeShowUnit::SaveImage(n_winID, n_path);
66 | }
67 |
68 | bool Yoga::Wrapper::ShowUnit::IsEmpty(HTuple ^ winID)
69 | {
70 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
71 |
72 | return NativeShowUnit::IsEmpty(n_winID);
73 | }
74 |
75 | void Yoga::Wrapper::ShowUnit::ChangeGraphicSettings(HTuple ^ winID, HTuple ^ mode, HTuple ^ val)
76 | {
77 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
78 | HalconCpp::HTuple n_mode = Conversion::TupleToNative(mode);
79 | HalconCpp::HTuple n_val = Conversion::TupleToNative(val);
80 | NativeShowUnit::ChangeGraphicSettings(n_winID, n_mode, n_val);
81 | }
82 |
83 | void Yoga::Wrapper::ShowUnit::SetImageSize(HTuple ^ winID, double imageWidth, double imageHeight)
84 | {
85 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
86 | NativeShowUnit::SetImageSize(n_winID, imageWidth, imageHeight);
87 | }
88 |
89 | void Yoga::Wrapper::ShowUnit::SetBackgroundColor(HTuple ^ winID, HTuple ^ color)
90 | {
91 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
92 | HalconCpp::HTuple n_color = Conversion::TupleToNative(color);
93 | NativeShowUnit::SetBackgroundColor(n_winID, n_color);
94 | }
95 |
96 | void Yoga::Wrapper::ShowUnit::ShowHat(HTuple ^ winID, bool isShowCross)
97 | {
98 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
99 | NativeShowUnit::ShowHat(n_winID, isShowCross);
100 | }
101 | System::String^ Yoga::Wrapper::ShowUnit::GetPixMessage(HTuple ^ winID, [Out]HTuple^% currX, [Out]HTuple^% currY)
102 | {
103 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
104 | std::string n_data;
105 | HalconCpp::HTuple n_x, n_y;
106 | //double x, y;
107 | n_data = NativeShowUnit::GetPixMessage(n_winID, &n_x, &n_y);
108 | currX = Conversion::TupleToManaged(n_x);
109 | currY = Conversion::TupleToManaged(n_y);
110 | System::String^data = Conversion::StringToManged(n_data);
111 | return data;
112 | }
113 |
114 | HTuple ^ Yoga::Wrapper::ShowUnit::GetGrayHisto(HTuple ^ winID, HTuple ^ rectangle1)
115 | {
116 | HalconCpp::HTuple n_winID = Conversion::TupleToNative(winID);
117 | HalconCpp::HTuple n_rectangle1 = Conversion::TupleToNative(rectangle1);
118 | HalconCpp::HTuple n_data;
119 | n_data = NativeShowUnit::GetGrayHisto(n_winID, n_rectangle1);
120 | HTuple ^data = Conversion::TupleToManaged(n_data);
121 | return data;
122 | }
123 |
--------------------------------------------------------------------------------
/Yoga.Wrapper/ShowUnit.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Wrapper/ShowUnit.h
--------------------------------------------------------------------------------
/Yoga.Wrapper/Stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Wrapper/Stdafx.cpp
--------------------------------------------------------------------------------
/Yoga.Wrapper/Stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Wrapper/Stdafx.h
--------------------------------------------------------------------------------
/Yoga.Wrapper/UtilManaged.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Wrapper/UtilManaged.cpp
--------------------------------------------------------------------------------
/Yoga.Wrapper/UtilManaged.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include"Util.h"
3 |
4 | using namespace System;
5 | using namespace System::Runtime::InteropServices;
6 |
7 | class Util;
8 | namespace Yoga
9 | {
10 | namespace Wrapper {
11 |
12 | public delegate void EventDelegate(String^ msg);
13 |
14 | public ref class UtilManaged
15 | {
16 | public:
17 | UtilManaged();
18 | ~UtilManaged();
19 | EventDelegate^ NetCallback;
20 | private:
21 | void Callback(String^ msg);
22 | GCHandle delegateHandle;
23 | EventDelegate^ nativeCallback;
24 | };
25 | }
26 | }
--------------------------------------------------------------------------------
/Yoga.Wrapper/Wrapper.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 | {B1AB93B2-0CF1-4580-A799-7761BFE7371E}
23 | v4.5.2
24 | ManagedCProj
25 | Wrapper
26 | 8.1
27 | Yoga.Wrapper
28 |
29 |
30 |
31 | DynamicLibrary
32 | true
33 | v140
34 | true
35 | Unicode
36 |
37 |
38 | DynamicLibrary
39 | false
40 | v140
41 | true
42 | Unicode
43 |
44 |
45 | DynamicLibrary
46 | true
47 | v140
48 | true
49 | Unicode
50 |
51 |
52 | DynamicLibrary
53 | false
54 | v140
55 | true
56 | Unicode
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | true
78 | $(SolutionDir)..\bin\x86\$(Configuration)\
79 |
80 |
81 | true
82 | $(SolutionDir)\..\bin\x64\$(Configuration)\
83 |
84 |
85 | false
86 | $(SolutionDir)\..\bin\x86\$(Configuration)\
87 |
88 |
89 | false
90 | $(SolutionDir)\..\bin\x64\$(Configuration)\
91 |
92 |
93 |
94 | Level3
95 | Disabled
96 | WIN32;_DEBUG;%(PreprocessorDefinitions)
97 | Use
98 | $(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include\QtCore;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include;$(SolutionDir)Yoga.Native
99 | false
100 | true
101 |
102 |
103 | Qt5Core.lib;halconcpp.lib;Yoga.Native.lib
104 | C:\Qt\Qt5.9.1\5.9.1\msvc2015\lib;$(HALCONROOT)\lib\x86sse2-win32;$(SolutionDir)..\bin\x86\$(Configuration)\
105 |
106 |
107 |
108 |
109 | Level3
110 | Disabled
111 | _DEBUG;%(PreprocessorDefinitions)
112 | Use
113 | $(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include\QtCore;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include
114 | false
115 | false
116 |
117 |
118 | Qt5Core.lib;halconcpp.lib
119 | C:\Qt\Qt5.9.1\5.9.1\msvc2015_64\lib;$(HALCONROOT)\lib\x64-win64;%(AdditionalLibraryDirectories)
120 |
121 |
122 |
123 |
124 | Level3
125 | WIN32;NDEBUG;%(PreprocessorDefinitions)
126 | Use
127 | true
128 | true
129 | $(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include\QtCore;C:\Qt\Qt5.9.1\5.9.1\msvc2015\include;$(SolutionDir)Yoga.Native
130 |
131 |
132 | Qt5Core.lib;halconcpp.lib;Yoga.Native.lib
133 | C:\Qt\Qt5.9.1\5.9.1\msvc2015\lib;$(HALCONROOT)\lib\x86sse2-win32;$(SolutionDir)..\bin\x86\$(Configuration)\
134 |
135 |
136 |
137 |
138 | Level3
139 | NDEBUG;%(PreprocessorDefinitions)
140 | Use
141 | true
142 | true
143 | $(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;C:\Qt\Qt5.9.1\5.9.1\msvc2015_64\include\QtCore;C:\Qt\Qt5.9.1\5.9.1\msvc2015_64\include;$(SolutionDir)Yoga.Native
144 |
145 |
146 | Qt5Core.lib;halconcpp.lib;Yoga.Native.lib
147 | C:\Qt\Qt5.9.1\5.9.1\msvc2015_64\lib;$(HALCONROOT)\lib\x64-win64;$(SolutionDir)\..\bin\x64\$(Configuration)\;%(AdditionalLibraryDirectories)
148 |
149 |
150 |
151 |
152 | ..\..\..\..\..\..\Program Files\MVTec\HALCON-13.0\bin\dotnet35\halcondotnet.dll
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 | Create
173 | Create
174 | Create
175 | Create
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
--------------------------------------------------------------------------------
/Yoga.Wrapper/Wrapper.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;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 | {12d8a31c-4ebe-4c5a-ab05-595255cb954c}
18 |
19 |
20 | {da3166ff-0374-440a-8cde-11b143a08f82}
21 |
22 |
23 |
24 |
25 | 头文件
26 |
27 |
28 | 头文件
29 |
30 |
31 | 头文件
32 |
33 |
34 | 头文件
35 |
36 |
37 | 头文件
38 |
39 |
40 | 头文件\Native
41 |
42 |
43 |
44 |
45 | 源文件
46 |
47 |
48 | 源文件
49 |
50 |
51 | 源文件
52 |
53 |
54 | 源文件
55 |
56 |
57 | 源文件
58 |
59 |
60 | 源文件\Native
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | 资源文件
69 |
70 |
71 |
72 |
73 | 资源文件
74 |
75 |
76 |
--------------------------------------------------------------------------------
/Yoga.Wrapper/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Wrapper/app.ico
--------------------------------------------------------------------------------
/Yoga.Wrapper/app.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linyugang/VisionControl/1456b3020956d8057d0cb8a374794e22e9e274f5/Yoga.Wrapper/app.rc
--------------------------------------------------------------------------------
/Yoga.Wrapper/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by app.rc
4 |
--------------------------------------------------------------------------------