Halcon:Image、region、xld常用的处理
生活随笔
收集整理的這篇文章主要介紹了
Halcon:Image、region、xld常用的处理
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
一、讀取文件夾中的所有圖片
list_files ('C:/Users/fuping.liu/Desktop/檳榔有無頭/有頭', ['files','follow_links'], ImageFiles) tuple_regexp_select (ImageFiles, ['\(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$','ignore_case'], ImageFiles)for Index := 0 to |ImageFiles| - 1 by 1read_image (Image, ImageFiles[Index]) endfor二、圖像變量Region
1、預(yù)處理:
| 消除噪聲 | mean_image/ binomial_filter |
| 抑制小斑點(diǎn)或者細(xì)線 | median_image |
| 平滑 | smooth_image |
| 保存邊緣的平滑 | anisotropic_diffusion |
2、選擇相應(yīng)區(qū)域
3、計(jì)算相應(yīng)區(qū)域的面積,中心坐標(biāo):
area_center(regions,area,row,column)4、不規(guī)則區(qū)域的轉(zhuǎn)換:
shape_trans(region,regiontrans,type)convex hull凸包圍(由外向內(nèi)包圍)
outer_circle 外圓(能夠包括對(duì)象的半徑最小的圓形)
inner_circle 內(nèi)圓
rectangle1 正矩形
rectangle2 最小包圍矩形
inner_rectangle1 最大內(nèi)矩形
?
5、填充區(qū)域
fill_up (region, RegionFillUp)
?
三 圖型變量XLD(eXtended Line Descriptions)
1、XLD代表亞像素級(jí)別的輪廓或者多邊形
threshold_sub_pix(inputimage, output,requirement)gen_contour_region_xld(inputRegion,output,...)edges_sub_pix(image,output,...,...)注意:
在使用edges_sub_pix提取出來的結(jié)果,往往不是完整的圓形,需要用union來整合出完整的圓形。
2、XLD的選擇操作(select_shape_xld/selet_contours_xld):select_shape_xld(XLD:SelectedXLD:Features,Operation,Min,Max:) select_contours_xld(Contours:SelectedContours:Feature,Min1,Max1,Min2,Max2:)3、計(jì)算xld的面積以及中心位置:
area_center_xld(XLD:::Area,row,column,pointOrder)4、xld的合并操作:
union_colliner_contours_xld: 合并同一直線的xldunion_cocircular_contours_xld: 合并同圓的xldunion_adjacent_contours_xld: 合并相鄰的xld5、xld的轉(zhuǎn)換操作與region類似:
shape_trans_xld(XLD:XLDTrans:Type:)?
6、Xld的分割操作(segment_contours_xld)把初始xld分割成直線,直線和圓,直線和橢圓
segment_contours_xld(Contours: ContoursSplit: Mode,SmoothCont, MaxLineDist1, MaxLineDist2:)?
7、Xld 的擬合操作(fit_***_contour_xld)? 把不完整的形狀擬合完整
fit_line_contour_xldfit_circle_contour_xldfit_ellipse_contour_xldfit_rectangle2_contour_xld?
總結(jié)
以上是生活随笔為你收集整理的Halcon:Image、region、xld常用的处理的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java程序开发的简历_Java程序开发
- 下一篇: Halcon: 畸变矫正与标定(1)