圆环划痕检测halcon
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                圆环划痕检测halcon
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.                        
                                文章目錄
- 處理要求
- 處理源碼
- 處理效果
| 
 | 
處理要求
查找圓環(huán)缺陷
 
處理源碼
read_image (Image, 'F:/HALCON/圓環(huán)劃痕處理/10_33221_ba4582f0e88ec79.bmp') rgb3_to_gray (Image, Image, Image, ImageGray) dev_close_window () dev_open_window_fit_image (ImageGray, 0, 0, -1, -1, WindowHandle) get_image_size (ImageGray, Width, Height) auto_threshold (ImageGray, Regions, 2) select_obj (Regions, ObjectSelected, 1) complement (ObjectSelected, RegionComplement) fill_up (RegionComplement, RegionFillUp) difference ( RegionFillUp,RegionComplement, RegionDifference) smallest_circle (RegionDifference, Row, Column, RadiusIn) boundary (RegionFillUp, RegionBorder, 'outer') dilation_circle (RegionBorder, RegionDilation, 3.5) reduce_domain (ImageGray, RegionDilation, ImageReduced) edges_sub_pix (ImageReduced, Edges,'canny', 0.5, 20, 40) segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 4, 2) union_cocircular_contours_xld (ContoursSplit, UnionContours, 0.9, 0.5, 0.5, 200, 50, 50, 'true', 1) length_xld (UnionContours, Length) select_obj (UnionContours, LongestContour, sort_index(Length)[|Length| - 1] + 1) fit_circle_contour_xld (LongestContour, 'algebraic', -1, 0, 0, 3, 2, Row1, Column1, RadiusOUT, StartPhi, EndPhi, PointOrder) gen_circle (Circle, Row1, Column1, RadiusOUT) dilation_circle (Circle, RegionDilation, 5) erosion_circle (Circle, RegionErosion,RadiusOUT-RadiusIn+5) difference (RegionDilation, RegionErosion, RegionDifference1) erosion_circle (RegionDifference1, RegionErosion1,8) reduce_domain (ImageGray, RegionDifference1, ImageReduced1) polar_trans_image_ext (ImageReduced1, PolarTransImage, Row1, Column1, 0, rad(360), RadiusIn, RadiusOUT, 6.28*RadiusOUT, RadiusOUT-RadiusIn, 'nearest_neighbor') dev_open_window_fit_image (PolarTransImage, 0, 0, -1, -1, WindowHandle1) mean_image (PolarTransImage, ImageMean, 100, 3) dyn_threshold (PolarTransImage, ImageMean, RegionDynThresh, 10, 'dark') connection (RegionDynThresh, ConnectedRegions) select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 5, 99999) polar_trans_region_inv (SelectedRegions, XYTransRegion, Row1, Column1, 0, rad(360), RadiusIn, RadiusOUT, 6.28*RadiusOUT, RadiusOUT-RadiusIn, Width, Height, 'nearest_neighbor') intersection (RegionErosion1, XYTransRegion, RegionIntersection) dev_set_window (WindowHandle) dev_display (ImageGray) dev_display (RegionIntersection)處理效果
------------------------------------------------------------------------------------------分割線 ------------------------------------------------------------------------------------------| 
 | 
| 
 | 
總結(jié)
以上是生活随笔為你收集整理的圆环划痕检测halcon的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: c语言开发arcgis,2017Esri
- 下一篇: Discuz3.3精仿小米风格整站模板制
