当前位置:网站首页>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 )
边栏推荐
- C语言-单词分析解析
- When dialogfragment's onstop is completely invisible, call disass to exit the interface and report an error. Solution
- [stm32 HAL库] 串口通信
- VSCode里使用条件断点(基于GDB)
- Use conditional breakpoints in vscode (based on GDB)
- frameworks/base/core/res/res/values/symbols.xml:3915: error: no definition for declared symbol解决办法
- Counting sorting and stability of sorting
- 入行数字IC验证后会做些什么?
- Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering
- 【狀態機設計】Moore、Mealy狀態機、三段式、二段式、一段式狀態機書寫規範
猜你喜欢

stm32F407-------NVIC中断优先级管理

VSCode里使用条件断点(基于GDB)

Cmake tutorial (I)

Lock4j -- distributed locking Middleware -- use / instance

LINQ linked table query

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

Counting sorting and stability of sorting

stm32F407-------电容触摸按键

Machine learning 6-decision tree

lock4j--分布式锁中间件--使用/实例
随机推荐
ERROR 1067 (42000): Invalid default value for ‘end_time‘ Mysql
关联线探究,如何连接流程图的两个节点
[stm32 Hal library] RTC and BKP drives
C interview questions_ 20220627 record
ctfshow XSS
Serious internal entanglement in the we media industry: where should the enterprise we media go
Undefined symbol main (referred from entry9a.o).
Keil project, RTT cannot print after too many programs are written
Ahai's advice
stm32F407-------通用定时器
lock4j--分布式锁中间件--使用/实例
Lock4j -- distributed locking Middleware -- use / instance
ERROR 1067 (42000): Invalid default value for ‘end_ time‘ Mysql
Is it safe to open a stock account on the Internet?
Learn binary tree like this
How to solve the database type error in the operation of the servert project?
Machine learning 4-dimension reduction technology
他原来是这么刷题的!
C語言-單詞分析解析
Don't ask me how to do UI automation test again