alon與C混合編程三數(shù)字識(shí)別_第1頁(yè)
alon與C混合編程三數(shù)字識(shí)別_第2頁(yè)
alon與C混合編程三數(shù)字識(shí)別_第3頁(yè)
alon與C混合編程三數(shù)字識(shí)別_第4頁(yè)
alon與C混合編程三數(shù)字識(shí)別_第5頁(yè)
已閱讀5頁(yè),還剩8頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、示例:數(shù)字識(shí)別要識(shí)別的圖片:halcon 源碼:1: 讀取圖片2: readmage(lmage, D/MyFile/halco門/數(shù)字識(shí)別 /l.jpg*)3:4: 圖像處理5: decompose3(lmage, ImageR, ImageG, ImageB)6: threshold (ImageG, Regio ns, 0, 183)7: conn ecti on (Regi ons, Conn ecti on)8:9: select_shape (Connection, SelectedRegions, area, and*, 1987.72, 7500)10:11: read_ocr

2、_class_mlp( ,Document_0-9.omc, ,OCRHandle)12: do_ocr_multi_class_mlp(SelectedRegio ns,lmageG,OCRHa ndle. Class, Con fide nee)halcon導(dǎo)出的C#代碼:2:Q-/ File gen erated by HDevelop for HALCON/DOTN(C#) Version10.0/O 4:/ This file is in ten ded to be used with the HDevelopTemplate or5:/ HDevelopTemplateWPF pr

3、ojects located1:/under %HALCONEXAMPLES%c#6:7: using System;8:using Hale on DotNet;9:10 public partial class HDevelopExport 11 public HTuple hv_ExpDefaultWinHandle;12 _13141516/ Mai n procedure private void action()17/ Local iconic variables1819202122HObject hojmage, hoJmageR, hoJmageG, hoJmageB;HObj

4、ect ho_Regions, ho_Connection, ho_SelectedRegions;232425/ Local con trol variablesHTuple hv_OCRHa ndle, hv_Class, hv_C27 onfidence;2829303132333435363738佃世劇血and output ico亦M矽肅難);nEmptyObj( e nEmptyObj( e nEmptyObj( e nEmptyObj( e 讀取圖片HOperatorSet.GHOperatorSet.GHOperatorSet.GHOperatorSet.Gout hoJmag

5、eR);out hoJmageG);out hoJmageB);out ho_Regi on s);out ho_C onn ecti on); out ho_SelectedRegi on s);nEmptyObj( HOperatorSet.G e n EmptyObj(39:HOperatorSet.Readlmage( out hojmage,識(shí)別/Ljpg”);D:/MyFile/halco n/ 數(shù)字40:41:圖像處理42:ho_lmageR.Dispose();43:ho_lmageG.Dispose();44:ho_lmageB.Dispose();45:HOperatorS

6、et.Decompose3(ho_lmage, out hoJmageR, outhomageG, out hoJmageB46);47ho_Regi on s.Dispose();48HOperatorSet.Threshold(hom ageG,out ho Regio ns, 0,49ho_C onn ectio n.Dispose();183);50HOperatorSet.C onnection( ho_Regiout ho_C onnection);51ons,52ho_SelectedRegio ns.Dispose();53HOperatorSet.SelectShape(ho

7、_C onn ectiooutho_SelecfbdRegio ns,54:1987.72, 756瞬 and”,55:56:HOperatorSet.ReadOcrClassMlp( nDocument_0-9.omc, outhv_OCRHa ndle);57:HOperatorSet.DoOcrMultiClassMlp(ho_SelectedRegio ns,hoJmageG, hv_OCRHa ndle,58 out hv_Class, out hv_C on fide nee);5960 ho_lmage.Dispose();61 ho_lmageR.Dispose();62 ho

8、_lmageG.Dispose();6364656667hoJmageB.Dispose(); ho_Regi on s.Dispose(); ho_C onn ectio n.Dispose(); ho_SelectedRegi on s.Dispose();68697071727374public void lnitHalcon()/ Default sett ings used in HDevelopHOperatorSet.SetSystem(udoJow_errorM, false”);757677public void Run Hale on (HTuple Win dow)78:

9、hv_ExpDefaultWi nHan die = Window;79:actio n();80:81:82:83:C#工程:using using using using using using using using1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:e)28:29:|*.bmp*|TIFF30:31:32:usingSystem;System.Collectio ns.Ge neric;System.Comp onen tModel;Syste rri. Data;System.

10、Drawi ng;Syste m l. i nq;System.Text;System.Wi ndows.Forms;HalconDotNet;n amespaceNumericalRecog niti on (public partial class FormMain : Form增加代碼:HDevelopExport HD = ewHDevelopExport();stri ng ImagePath;public FormMain()In itializeComp onen t(); btn Recog niti onNu mber.E n abled =false ;private vo

11、id btnOpenlmage_Click( object sender, EventArgsope nF ileDialog 1.Filter =文件If儼;“JPEG 文件 rjpg*|BMP 文件ope nF ileDialogl .RestoreDirectorytrue ;33:34:35:if (openFileDialogl ,ShowDialog() = DialogResult.OK)36:37:38:39:ImagePath = ope nFileDialogl .FileName;40:41:HD.Readlmage(hWi ndowC on troll .Halco n

12、Win dow,ImagePath);42:43:btnRecognitionNumber.Enabled =true ;44:45:46:47:48:private void btn Recog niti onNu mber_Click( object sen der,Even tArgs e)4950 HD.NumberRecog nitio n(); labNumber.Text = HD.hv_Class.ToStri51 ng();59 btn Recog niti onNu mber.E nabled =false60656B63 /halco n導(dǎo)出的類64 public par

13、tial class HDevelopExport66 public HTuple hv_ExpDefaultWinHandle;6767 HObject ho_Jmage, ho_JmageR, homageG, ho lmageB;68 HObject ho_Regi ons, ho_C onnection, ho_SelectedRegi ons;7069 6570 / Local con trol variables HTuple hv_OCRHa ndie, hv_C on fide nee;71 public HTuple hv_Class;74public void InitHa

14、lcon()/ Default sett ings used in HDevelopHOperatorSet.SetSystem(ndojow_error, ”false”); h36lmageG, out lpxDiblraag)BReacllmage(HTuple Window, string ImagePath)W);hxz)_EDefBslCAfipiHai(i)pile = Win dow;HOperatorSet.Threshold(ho_lmageG,out ho_Regions, o,1醐;/In itialize local and output ico nic variab

15、les85:out hojmage);腕:HOperatorSet.C onnection( ho_Regi ons,outh83C onn ecti on); 讀取圖片W:ho_lmage.Dispose();n; out ho hnaae maaePath),伽:冃3鮮加癟戲onn ecti on,out加MRMicnHan area*, ”and”, d);1987.72, 7500);870public void NumberRecognition()90:91:92:93:94:95:96:97:98:99:100:HOperatorSet.Ge nEmptyObj( HOperat

16、orSet.Ge nEmptyObj( HOperatorSet.Ge nEmptyObj( HOperatorSet.Ge nEmptyObj( HOperatorSet.Ge nEmptyObj( HOperatorSet.Ge nEmptyObj(圖像處理ho_lmageR.Dispose(); hoJmageG .Dispose。; ho_lmageB.Dispose();out hoJmageR);out hoJmageG);out hoJmageB); ho_Regi out on s); ho_C onn ectio out n); ho_SelectedRegio out ns);out hoJmageR, outHOperatorSet.ReadOcrClassMlp(nDocument_0-9.omc,out hv_OCRHa ndle);114:115:116:117:118:119:120:121:122:123:124:125:126:127:128:113:HOperatorSet.Do

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論