機(jī)器視覺
完成halcon與C#混合編程的環(huán)境配置后,進(jìn)行界面布局設(shè)計(jì)構(gòu)思每一個(gè)按鈕所需要實(shí)現(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程序時(shí),如果過程中的圖片需要顯示出來,則需要在每個(gè)過程中都添加dev_display(**)第一步:導(dǎo)出C#程序,建立項(xiàng)目,并添加此類 //// 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