機(jī)器視覺
完成halcon與C#混合編程的環(huán)境配置后,進(jìn)行界面布局設(shè)計構(gòu)思每一個按鈕所需要實現(xiàn)的功能,將Halcon導(dǎo)出的代碼復(fù)制至相應(yīng)的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(**)第一步:導(dǎo)出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