版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
跟我學(xué)機(jī)器視覺-HALCON學(xué)習(xí)例程中文詳解-IC引腳測量*LeadMeasurement:Examplefortheapplicationofthemeasureobject*includingalotofvisualizationoperators.*First,thelengthoftheleadsismeasured,then,theirwidthanddistancefromeachother.***First,readintheimageandinitializetheprogramread_image(Image,'ic_pin')*****************取得圖像第一通道的指針,同時(shí)得到圖像寬度高度*********get_image_pointer1(Image,Pointer,Type,Width,Height)dev_close_window()dev_open_window_fit_image(Image,0,0,509,509,WindowHandle)set_display_font(WindowHandle,14,'mono','true','false')dev_set_draw('margin')dev_set_line_width(3)*、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、!>dev_display(Image)k1*k1*k1*顯示圖像如下:*DefineanddisplaytherectangularROIswithinwhichtheedgeswillbedetectedRow:=55RowBottom:=955
Column:=200Phi:=rad(-90)Length1:=50Length2:=35dev_set_color('gray')gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)gen_rectangle2(Rectangle,RowBottom,Column,Phi,Length1,Length2)*************************測量位置如綠色矩形所示下:**************************圖形窗□:3600-Rectangle易丨詢也亀%*圖形窗□:3600-Rectangle易丨詢也亀%*H適應(yīng)窗口- 100%★disp_continue_message(WindowHandle,'black','true')stop()**CreateameasureobjectfortheROIatthetopoftheimage.******獲取一階灰度剖面圖的插值方法,測量矩形框與圖像坐標(biāo)系之間有角度時(shí)生效******Interpolation:='nearest_neighbor'gen_measure_rectangle2(Row,Column,Phi,Length1,Length2,Width,Height,Interpolation,MeasureHandle)、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>生成測量矩形框,、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>生成測量矩形框,先測上部、、、、、、、、、、、、、、、、、、、、、、、、、、、、!>**DeterminealledgesandcalculatetheleadheightatthetopoftheimageSigma:=1.0Threshold:=30
Transition:='all'Select:='all'一.、‘k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*、一甲.measure_pos(Image,MeasureHandle,Sigma,Threshold,Transition,Select,RowEdge,ColumnEdge,Amplitude,Distance)LeadLength1:=Distance*Displaytheresultsdev_set_color('white')k1*k1*、k1*k1*、、、、、、、、、、、、、、、、、、、、、、、、k1*■M圖旳窗口:3600-■M圖旳窗口:3600-RectangleiiiiririiiiiinTmnmTiTvrjinmrnvjniPressRun(F5)tocontinue醪[觀也歐%k11適應(yīng)窗口F畫100%kdisp_line(WindowHandle,RowEdge,ColumnEdge-Length2,RowEdge,ColumnEdge+Length2)disp_message(WindowHandle,'LeadLength:'+LeadLength1$'.2f','window',RowEdge[1]+40,ColumnEdge[1]+100,'yellow','false')*Shiftthemeasureobjectanddeterminetheleadheightatthebottomoftheimage************************轉(zhuǎn)移測量框至新的參考坐標(biāo)點(diǎn),及測量下部******************translate_measure(MeasureHandle,RowBottom,Column)一.、‘k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*、一應(yīng)工甲.measure_pos(Image,MeasureHandle,Sigma,Threshold,Transition,Select,RowEdge,ColumnEdge,Amplitude,Distance)LeadLength2:=Distance
*Displaytheresultsdev_set_color('white')、、、、、、、、、、、、、、、、、k1************************************將測量結(jié)果畫出適應(yīng)窗口100%口叵區(qū)圖旳窗□:3600-Rectangle***********************************將測量結(jié)果畫出適應(yīng)窗口100%口叵區(qū)圖旳窗□:3600-RectanglePressRun(F5)tocontinue**Closethemeasureclose_measure(MeasureHandle)disp_continue_message(WindowHandle,'black','true')stop()**Now,defineanddisplayarectangularROIperpendiculartotheleadsandcreatethemeasuredev_display(Image)Row:=47Column:=485Phi:=0Length1:=420Length2:=8Interpolation:='nearest_neighbor'dev_set_color('black')*******************創(chuàng)建新的測量矩形ROI,如圖藍(lán)色矩形:gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)gen_measure_rectangle2(Row,Column,Phi,Length1,Length2,Width,Height,Interpolation,MeasureHandle)**Determinealledgepairsthathaveanegativetransition,i.e.,edgepairs*thatenclosedarkregions.Sigma:=1.0Threshold:=30Transition:='negative'Select:='all'measure_pairs(Image,MeasureHandle,Sigma,Threshold,Transition,Select,RowEdgeFirst,ColumnEdgeFirst,AmplitudeFirst,RowEdgeSecond,ColumnEdgeSecond,AmplitudeSecond,IntraDistance,InterDistance)disp_continue_message(WindowHandle,'black','true')stop()dev_set_color('white')disp_line(WindowHandle,RowEdgeFirst,ColumnEdgeFirst,RowEdgeSecond,ColumnEdgeSecond)avgLeadWidth:=sum(IntraDistance)/|IntraDistance|avgLeadDistance:=sum(InterDistance)/|InterDistance|numLeads:=|IntraDistance|disp_message(WindowHandle,'NumberofLeads:'+numLeads,'window',200,100,'yellow','false')disp_message(WindowHandle,'AverageLeadWidth:'+avgLeadWidth$'.2f','window',260,100,'yellow','false')disp_message(WindowHandle,'AverageLeadDistance:'+avgLeadDistance$'.2f','window',320,100,'yellow','false')disp_continue_message(WindowHandle,'black','true')disp_continue_message(WindowHandle,'black','true')stop()
*Zoomintovisualizethemeasurementresultsinmoredetail.*First,defineanddisplaythezoomwindow.Row1:=0Column1:=600Row2:=100Column2:=700dev_set_color('blue')k1*、、、、、、、、、、、、k1*、、、、、、、、、、、、、、、!>設(shè)置放大區(qū)域矩形并顯示,圖中綠色矩形disp_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)disp_continue_message(WindowHandle,'black','true')stop()**Then,zoomtheimageanddisplaytheresults.k1*k1*、、、、、、、、、、、、、、、、、、!>設(shè)置圖像放大區(qū)域并顯示k1*k1*、、、、、、、、、、、、、、、、、、、、、、、、、、、、、k1*dev_set_part(Row1,Column1,Row2,Column2)dev_display(Image)、、、、、、、、、、、、k1*dev_set_color('black')**********************畫出測量矩形ROI和測得的邊緣如圖dev_display(Rectangle)p_disp_edge_marker(RowEdgeFirst,ColumnEdgeFir
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 警務(wù)室調(diào)解制度
- 用電基礎(chǔ)知識培訓(xùn)
- 2025高一政治期末模擬卷01(考試版)【測試范圍:必修1全冊+必修2全冊】(新高考用)含答案
- 醫(yī)院愛崗敬業(yè)培訓(xùn)課件
- 國考公安考試試題及答案
- 2026年上半年浙江杭州市婦產(chǎn)科醫(yī)院(杭州市婦幼保健院)高層次、緊缺專業(yè)人才招聘15人(總)備考考試試題附答案解析
- 2026某事業(yè)單位招聘保潔崗位1人備考考試題庫附答案解析
- JIS D 9101-2012 自行車術(shù)語標(biāo)準(zhǔn) Cycles - Terminology
- 2026福建福州市平潭綜合實(shí)驗(yàn)區(qū)黨工委黨校(區(qū)行政學(xué)院、區(qū)社會主義學(xué)院)招聘編外工作人員1人備考考試題庫附答案解析
- 2026福建龍巖鑫達(dá)彩印有限公司龍巖鑫利來酒店分公司(第一批)招聘3人參考考試試題附答案解析
- 西藏轉(zhuǎn)移就業(yè)課件
- 2026-2031中國房地產(chǎn)估價(jià)市場分析預(yù)測研究報(bào)告
- 2025年繩索技術(shù)理論題庫及答案
- 天津市和平區(qū)2025年高二化學(xué)第一學(xué)期期末監(jiān)測試題含解析
- 供熱企業(yè)環(huán)保知識培訓(xùn)課件
- 工業(yè)園招商課件
- 護(hù)理帶教老師小講課
- 氟硅烷改性自清潔涂層的制備及性能表征
- 特警小組戰(zhàn)術(shù)課件大綱
- 電氣設(shè)備維護(hù)保養(yǎng)手冊模板
- 3.1城市的輻射功能課件-高中地理人教版選擇性必修2
評論
0/150
提交評論