当前位置:网站首页>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 )
边栏推荐
- Machine learning 6-decision tree
- 第五章 虚拟存储器 练习
- 在DialogFragment的onStop(完全不可见)时调用dismiss退出界面报错解决办法
- [Electronic Experiment 2] simple electronic doorbell
- 他原来是这么刷题的!
- CIN at QT (the clearest tutorial in the whole network)
- 一张能卖上千万,商家扩张比玩家还快:球星卡的江湖你不懂
- Keil project, RTT cannot print after too many programs are written
- Serious internal entanglement in the we media industry: where should the enterprise we media go
- Learn binary tree like this
猜你喜欢

Machine learning 4-dimension reduction technology

PHP 使用endroid/qrcode 二维码生成, GD库生成分享海报

Analysis of CSRF Cross Site Request Forgery vulnerability

2022年PMP项目管理考试敏捷知识点(4)
![[mathematical modeling] fmincon() function of MATLAB nonlinear programming](/img/fc/46949679859b1369fcc83d0d8b637c.png)
[mathematical modeling] fmincon() function of MATLAB nonlinear programming

【Word 教程系列第 2 篇】Word 中如何设置每页的表格都有表头
![[stm32 Hal library] serial port communication](/img/2c/23a2ecf75141b8f38ab99ac6b2eaef.png)
[stm32 Hal library] serial port communication

ctfshow XSS

stm32F407-------外部中断

stm32F407-------NVIC中断优先级管理
随机推荐
第三章 处理机调度练习
Junior, it's not easy!
What is the lifecycle of automated testing?
Flutter obtains the coordinate size of any element in the interface through globalkey
关联线探究,如何连接流程图的两个节点
一张能卖上千万,商家扩张比玩家还快:球星卡的江湖你不懂
Learning fuzzy from SQL injection to bypass the latest safe dog WAF
Serious internal entanglement in the we media industry: where should the enterprise we media go
Add the premise of ganggan
TDD和自动化测试
ERROR 1067 (42000): Invalid default value for ‘end_ time‘ Mysql
Association line exploration, how to connect the two nodes of the flow chart
note
Scrapy使用xlwt实现将数据以Excel格式导出的Exporter
Interviewer: what is the internal implementation of strings in redis?
What will be done after digital IC Verification?
第四章 存储器管理练习
[stm32 HAL库] RTC和BKP驱动
frameworks/base/core/res/res/values/symbols. Xml:3915: error: no definition for declared symbol solution
Keil project, RTT cannot print after too many programs are written