当前位置:网站首页>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 )
边栏推荐
- [SSM] an error is reported that the user name of the access denied for user 'WYF' @ 'localhost' (using password: yes) data becomes the user name of the computer
- TDD case practice
- Counting sorting and stability of sorting
- CIN at QT (the clearest tutorial in the whole network)
- note
- With a monthly salary of 60000 yuan, such people began to be robbed after the Internet "reduced costs and increased efficiency"
- stm32F407-------电容触摸按键
- 关联线探究,如何连接流程图的两个节点
- The picture display on the left of the two column layout is determined by the content height on the right
- 2022年PMP项目管理考试敏捷知识点(4)
猜你喜欢

第四章 存储器管理练习

Chapter V virtual memory exercise

Behaviortree in ros2
![[Electronic Experiment 2] simple electronic doorbell](/img/40/227f9ac1f427c1435e0e3aa02640b1.png)
[Electronic Experiment 2] simple electronic doorbell

CMake教程(一)

Interviewer: what is the internal implementation of strings in redis?

第五章 虚拟存储器 练习

2022年PMP项目管理考试敏捷知识点(4)

IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021

Huawei's level 22 experts have worked hard for ten years to complete the advanced practical document of cloud native service grid. 6
随机推荐
老家出资,俞敏洪设立两支基金
【SSM】报错 Access denied for user ‘WYF‘@‘localhost‘ (using password: YES) 数据的用户名变成了电脑的用户名
[stm32 HAL库] RTC和BKP驱动
PHP uses endroid/qrcode QR code to generate, and Gd library generates sharing posters
Undefined symbol main (referred from entry9a.o).
2022-06-28:以下golang代码输出什么?A:true;B:false;C:panic;D:编译失败。 package main import “fm
Ahai's advice
TDD案例实战
Huawei's level 22 experts have worked hard for ten years to complete the advanced practical document of cloud native service grid. 6
IO playback function of FIO
从SQL注入绕过最新安全狗WAF中学习fuzz
PHP uses curl to download Excel files after logging in to the website
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
[stm32 HAL库] 串口通信
Picture 64base transcoding and decoding
月薪6万,互联网“降本增效”后,这类人开始被疯抢
CMake教程(一)
[chapter 71 of the flutter problem series] mutual conversion between uint8list and image in flutter
Would like to ask, how to open a stock account? Is it safe to open an account online?
笔记