机器视觉
完成halcon与C#混合编程的环境配置后,进行界面布局设计构思每一个按钮所需要实现的功能,将Halcon导出的代码复制至相应的C#模块下即可。 halcon源程序:dev_open_window(0, 0, 512, 512, 'black', WindowHandle)read_image (Image, 'C:/Users/Administrator/Desktop/猫.jpg')dev_display(Image)get_image_size(Image, Width, Height)rgb3_to_gray(Image, Image, Image, ImageGray)dev_display(ImageGray)注意:写halcon程序时,如果过程中的图片需要显示出来,则需要在每个过程中都添加dev_display(**)第一步:导出C#程序,建立项目,并添加此类 //// File generated by HDevelop for HALCON/DOTNET (C#) Version 10.0//// This file is intended to be used with the HDevelopTemplate or// HDevelopTemplateWPF projects located under %HALCONEXAMPLES%\c#using System;using HalconDotNet;public partial class HDevelopExport{ public HTuple hv_ExpDefaultWinHandle; // Main procedure private void action() { // Local iconic variables HObject ho_Image, ho_ImageGray; // Local control variables HTuple hv_Width, hv_Height; ...
2017
-
10
-
16