当前位置:网站首页>Edge extraction based on Halcon learning [2] circles Hdev routine
Edge extraction based on Halcon learning [2] circles Hdev routine
2022-06-28 23:35:00 【BoomBiuBiu】
The edges in the image are divided into lines and circles , For edges that are part of a circle , The circle parameters are estimated and the resulting circle is displayed .
* Read the picture
read_image (Image, 'double_circle')
* close window
dev_close_window ()
* Get the size of the picture
get_image_size (Image, Width, Height)
* open windows
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
* Split the area containing edges
* Fast binarization
fast_threshold (Image, Region, 0, 120, 7)
* Get the edge of the area --- Outline the area
boundary (Region, RegionBorder, 'inner')
* Relative to its smallest surrounding rectangular clipping area .
clip_region_rel (RegionBorder, RegionClipped, 5, 5, 5, 5)
* inflation
dilation_circle (RegionClipped, RegionDilation, 2.5)
* Cutout
reduce_domain (Image, RegionDilation, ImageReduced)
* In the image subdomain containing the edge , Extract sub-pixel precise edge .
* Use Deriche、Lanser、Shen or Canny The filter extracts sub-pixel precise edges .
edges_sub_pix (ImageReduced, Edges, 'canny', 2, 20, 60)
* Sub pixel contour lines are divided into line segments and arc or elliptical arc .
segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 4, 3)
* Count
count_obj (ContoursSplit, Number)
dev_display (Image)
dev_set_draw ('margin')
dev_set_color ('white')
dev_update_window ('off')
for I := 1 to Number by 1
* Select the specified element in the array through the index number
select_obj (ContoursSplit, ObjectSelected, I)
* return xld The global attribute value of the profile
get_contour_global_attrib_xld (ObjectSelected, 'cont_approx', Attrib)
*Attrib Yes -1 0 1
* Fit the circle to the arc segment of the circle
if (Attrib > 0)
* Yes XLD Arc fitting of contour
fit_circle_contour_xld (ObjectSelected, 'ahuber', -1, 2, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)
* Draw the fitted circle
gen_circle_contour_xld (ContCircle, Row, Column, Radius, 0, rad(360), 'positive', 1.0)
* Display circle
dev_display (ContCircle)
endif
endfor
* Set the color 、 Line width
dev_set_colored (12)
dev_set_line_width (3)
* Show edges
dev_display (ContoursSplit)* Read the picture
read_image (Image, 'double_circle')
* close window
dev_close_window ()
* Get the size of the picture
get_image_size (Image, Width, Height)
* open windows
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
* Split the area containing edges
* Fast binarization
fast_threshold (Image, Region, 0, 120, 7)
* Get the edge of the area --- Outline the area
boundary (Region, RegionBorder, 'inner')
* inflation
dilation_circle (RegionClipped, RegionDilation, 2.5)
* Cutout
reduce_domain (Image, RegionDilation, ImageReduced)
* Use Deriche、Lanser、Shen or Canny The filter extracts sub-pixel precise edges .
edges_sub_pix (ImageReduced, Edges, 'canny', 2, 20, 60)
* Sub pixel contour lines are divided into line segments and arc or elliptical arc .
segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 4, 3)
* Count
count_obj (ContoursSplit, Number)
dev_display (Image)
dev_set_draw ('margin')
dev_set_color ('white')
dev_update_window ('off')
for I := 1 to Number by 1
* Select the specified element in the array through the index number
select_obj (ContoursSplit, ObjectSelected, I)
* return xld The global attribute value of the profile
get_contour_global_attrib_xld (ObjectSelected, 'cont_approx', Attrib)
*Attrib Yes -1 0 1
* Fit the circle to the arc segment of the circle
if (Attrib > 0)
* Yes XLD Arc fitting of contour
fit_circle_contour_xld (ObjectSelected, 'ahuber', -1, 2, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)
* Draw the fitted circle
gen_circle_contour_xld (ContCircle, Row, Column, Radius, 0, rad(360), 'positive', 1.0)
* Display circle
dev_display (ContCircle)
endif
endfor
* Set the color 、 Line width
dev_set_colored (12)
dev_set_line_width (3)
* Show edges
dev_display (ContoursSplit) 

clip_region_rel(Region : RegionClipped : Top, Bottom, Left, Right : )
function : Relative to its smallest surrounding rectangular clipping area .
Region : Input area ;RegionClipped : The output area is reduced ;Top, Bottom, Left, Right: Internal shrinkage .
Reduce the area by eliminating the part near the smallest surrounding rectangle of the area . say concretely , This means that the area is clipped small
A rectangle equal to or greater than the smallest surrounding rectangle
edges_sub_pix(Image : Edges : Filter, Alpha, Low, High : )
function : Use Deriche,Lanser,Shen or Canny The filter extracts sub-pixel precise edges
Image : The input image ;Edges : The edge of the output ;Alpha: Filter width ;
Low: Lower threshold for hysteresis threshold operation ;High: Upper threshold limit for hysteresis threshold operation
egment_contours_xld(Contours : ContoursSplit :Mode, SmoothCont, MaxLineDist1, MaxLineDist2 : )
function : Division XLD The outline is a line segment and an arc or an elliptical arc
Contours : Enter the profile ;ContoursSplit: The contour after segmentation ;Mode: Contour segmentation mode ;
SmoothCont: The number of points used to smooth the contour ;MaxLineDist1: The maximum distance between the contour and the approximate line ( for the first timeiteration );MaxLineDist2 : The maximum distance between the contour and the approximate line ( Second iteration )
边栏推荐
- [stm32 Hal library] RTC and BKP drives
- 没找到实习,他总结了这些
- ERROR 1067 (42000): Invalid default value for ‘end_ time‘ Mysql
- Yes, use local_ setup. Bash or setup bash
- Solve the problem of Chinese parsing by configparser
- Keil project, RTT cannot print after too many programs are written
- TDD案例实战
- [chapter 71 of the flutter problem series] mutual conversion between uint8list and image in flutter
- 表单校验问题——el-select(初始化页面自动触发校验解决办法)
- C語言-單詞分析解析
猜你喜欢
![[Electronic Experiment 2] simple electronic doorbell](/img/40/227f9ac1f427c1435e0e3aa02640b1.png)
[Electronic Experiment 2] simple electronic doorbell
![[state machine design] Moore, Mealy state machine, three-stage, two-stage and one-stage state machine writing specification](/img/48/e29f34aff7cc437bfb574591d54e3d.png)
[state machine design] Moore, Mealy state machine, three-stage, two-stage and one-stage state machine writing specification

Use conditional breakpoints in vscode (based on GDB)

stm32F407-------RTC实时时钟

再次上榜!知道创宇入选2022中国网安产业竞争力50强

C# 面试题目_20220627记录一下

The picture display on the left of the two column layout is determined by the content height on the right
![[word Tutorial Series Part 1] how to remove arrows in word tables](/img/c7/dc57002b0e9d433c4dfac15d53713d.png)
[word Tutorial Series Part 1] how to remove arrows in word tables

ROS2中的行为树 BehaviorTree

关联线探究,如何连接流程图的两个节点
随机推荐
Class extension and optional type extension of dart
That's how he did it!
10. Standard i/o redirection and pipeline
【软件分析】软件分析、设计与建模迭代式详解
stm32F407-------外部中断
这样学习二叉树
Be on the list again! Know that Chuangyu was selected as one of the top 50 competitive enterprises in China's network security industry in 2022
Don't ask me how to do UI automation test again
[chapter 71 of the flutter problem series] mutual conversion between uint8list and image in flutter
IO playback function of FIO
[matlab] function definition and use
stm32F407-------通用定时器
Behaviortree in ros2
解决ConfigParser解析中文问题
Counting sorting and stability of sorting
非科班!自学之路!
window10 phpstudy 安装redis扩展
ctfshow XSS
[state machine design] Moore, Mealy state machine, three-stage, two-stage and one-stage state machine writing specification
stm32F407-------电容触摸按键