find_pads.hdev例程相关学习
2015-07-18 14:40
239 查看
index:.../Applications/Positon-Recognition-2D/find_pads.hdev
应用范围-二维位置定位
![](http://r.photo.store.qq.com/psb?/V107AzBJ09J1zC/uD15bbyDPgwKRbzitvXVdwdGpqf5GvKc21DvBylphKM!/o/dGkAAAAAAAAA&bo=TAMyAkwDMgIDACU!)
* This example program shows how to find pads in an image and how to
* determine their position, rotation, and size robustly and accurately using
* fit_rectangle2_contour_xld.
dev_update_pc ('off')
dev_update_window ('off')
dev_update_var ('off')
read_image (Image, 'die_pads')
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width * 2, Height * 2, 'black', WindowHandle)
dev_set_part (0, 0, Height - 1, Width - 1)
* Find the pads in the image using blob analysis.
fast_threshold (Image, Region, 180, 255, 20)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, ['area','anisometry'], 'and', [200,1], [1200,2])
* Construct a ROI for subpixel-accurate edge detection.
fill_up (SelectedRegions, RegionFillUp)
shape_trans (RegionFillUp, RegionTrans, 'convex')
boundary (RegionTrans, RegionBorder, 'inner')
dilation_circle (RegionBorder, RegionDilation, 2.5)
union1 (RegionDilation, RegionUnion)
固定流程,fillup--shapetrans(conve凸)--取内边缘--膨胀--合体1
* Perform the subpixel-accurate edge detection.
reduce_domain (Image, RegionUnion, ImageReduced)
edges_sub_pix (ImageReduced, Edges, 'sobel_fast', 0.5, 20, 40)
在提取的只有pads边框那一胖圈的地方提取边缘 edges
* Select the edge fragments that belong to the pads.
select_shape_xld (Edges, SelectedContours, 'contlength', 'and', 10, 200)
'contlength':Total length of contour (see length_xld)
* Merge adjacent edge fragments to obtain one contour per pad.
union_adjacent_contours_xld (SelectedContours, UnionContours, 2, 1, 'attr_keep')
* Fit rectangles robustly to the pads' edges.
fit_rectangle2_contour_xld (UnionContours, 'tukey', -1, 0, 0, 3, 2, Row, Column, Phi, Length1, Length2, PointOrder)
* Generate rectangles from the fitting result for visualization purposes.
gen_rectangle2_contour_xld (Rectangle, Row, Column, Phi, Length1, Length2)
dev_display (Image)
dev_set_colored (12)
dev_display (Rectangle)
在稳定实现功能后,开始注意代码规范,不然不值26万円給料。
应用范围-二维位置定位
* This example program shows how to find pads in an image and how to
* determine their position, rotation, and size robustly and accurately using
* fit_rectangle2_contour_xld.
dev_update_pc ('off')
dev_update_window ('off')
dev_update_var ('off')
read_image (Image, 'die_pads')
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width * 2, Height * 2, 'black', WindowHandle)
dev_set_part (0, 0, Height - 1, Width - 1)
* Find the pads in the image using blob analysis.
fast_threshold (Image, Region, 180, 255, 20)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, ['area','anisometry'], 'and', [200,1], [1200,2])
* Construct a ROI for subpixel-accurate edge detection.
fill_up (SelectedRegions, RegionFillUp)
shape_trans (RegionFillUp, RegionTrans, 'convex')
boundary (RegionTrans, RegionBorder, 'inner')
dilation_circle (RegionBorder, RegionDilation, 2.5)
union1 (RegionDilation, RegionUnion)
固定流程,fillup--shapetrans(conve凸)--取内边缘--膨胀--合体1
* Perform the subpixel-accurate edge detection.
reduce_domain (Image, RegionUnion, ImageReduced)
edges_sub_pix (ImageReduced, Edges, 'sobel_fast', 0.5, 20, 40)
在提取的只有pads边框那一胖圈的地方提取边缘 edges
* Select the edge fragments that belong to the pads.
select_shape_xld (Edges, SelectedContours, 'contlength', 'and', 10, 200)
'contlength':Total length of contour (see length_xld)
* Merge adjacent edge fragments to obtain one contour per pad.
union_adjacent_contours_xld (SelectedContours, UnionContours, 2, 1, 'attr_keep')
* Fit rectangles robustly to the pads' edges.
fit_rectangle2_contour_xld (UnionContours, 'tukey', -1, 0, 0, 3, 2, Row, Column, Phi, Length1, Length2, PointOrder)
* Generate rectangles from the fitting result for visualization purposes.
gen_rectangle2_contour_xld (Rectangle, Row, Column, Phi, Length1, Length2)
dev_display (Image)
dev_set_colored (12)
dev_display (Rectangle)
在稳定实现功能后,开始注意代码规范,不然不值26万円給料。
相关文章推荐
- HDU 1556 Color the ball(区间标记或者线段树)
- 黑马程序员--集合框架
- (转载)Halcon学习(二十一)摄像机标定常用函数(二)
- windows 下构建 Eclipse gdb 调试平台调试arm程序
- Yii 1.0 基础
- 自定义点赞切换控件
- ASP.NET的Page_Load事件
- (转载)Halcon学习(十七)标定板的规格
- (转载)Halcon学习(二十)摄像机标定常用函数(一)
- 银行储蓄系统
- OC_类和对象
- ACM学习-输入输出
- git查看某个文件的修改历史
- Creat_average_shape_model.hdev例程相关学习(三)
- css3属性(一)
- 我从腾讯那“偷了”3000万QQ用户数据,出了份很有趣的独家报告!
- Hadoop2.2.0 手动切换HA环境搭建
- 反汇编uimage和查看符号表的方法
- Unique Paths II
- sphinx全文检索之PHP使用教程