当前位置:网站首页>Halcon knowledge: regional topics [07]
Halcon knowledge: regional topics [07]
2022-06-30 16:39:00 【Mr anhydrous】
One 、 summary
This article and halcon Area of : Multiple areas (Region) features (6) Belong to the same blog , In this article, we will continue with the operators of matrices , Including moment features . Hamming distance, etc .
Two 、 Domain operator
2.1 regiongrowing Is an algorithm for merging regions
regiongrowing: Divide the image into regions of the same intensity --- The rasterization size is Row * Column The rectangular . To determine whether two adjacent rectangles belong to the same region , Only use the gray value of their center point . If the gray value difference is less than or equal to Tolerance, Then the rectangle is merged into a region .
If g_{1} and g_{2} Are the two gray values to be checked , Then merge them into the same region in the following cases :
1) | g_{1} - g_{2} | < torlerance
2) | g_{1} - g_{2} | < torlerance & | g_{1} - g_{2} | < 127
3) 255 - | g_{1} - g_{2} | < torlerance & 127 < | g_{1} - g_{2} |
2.2 expand_region Fill the area gap
expand_region Fill the gap between the input fields , This is due to the suppression of small regions in the segmentation operator , for example ,( Pattern “ Images ”) Or separate overlapping areas ( Pattern “ Area ”). Both of these uses stem from the expansion of the region . The operator adds or removes a pixel wide... To an area “ strip ” Come to work .
Extension occurs only when specified as non “ prohibit ” Region ( Parameters ForbiddenArea). The number of iterations is determined by the parameter Iterations determine . By passing “ Maximum ”,expand_region Iterate until it converges , namely , Until it doesn't change . By passing 0, All non overlapping areas will be returned . Two modes of operation (“ Images ” and “ Area ”) There are differences in the following aspects :
'Image'
The input area is expanded iteratively , Until they touch another area or image boundary . under these circumstances , The image boundary is defined from (0,0) To (row_max,col_max) The rectangular . here ,(row_max,col_max) Corresponds to all input fields ( That is to say Regions and ForbiddenArea All areas passed in ) The bottom right corner of the smallest surrounding rectangle . because expand_region Process all areas at the same time , So the gap between regions is evenly distributed to all regions . The overlapping region is divided by evenly distributing the overlapping region to two regions .'region'
Do not extend the input area . contrary , Only the overlapping region is divided by evenly distributing the overlapping region to each region . Because the intersection with the original area is calculated after the shrink operation gap of the output area , That is, the segmentation is incomplete . This can be done by a second call to expand_region To prevent , Take the complement of the original region as “ Forbidden area ”.
2.3 get_region_index
function : Index of all areas including a given pixel . Is to give a coordinate , Which area does this coordinate fall into .
- get_region_index(Regions : : Row, Column : Index)
2.4 get region_thickness
function : Check the width of the area near the spindle ( The thickness of the ).
- get_region_thickness(Region : : : Thickness, Histogramm)
Operator get_region_thickness Calculate each pixel in the section along the main axis ( See elliptic_axis) Area thickness of . The thickness at a certain point on the spindle is defined as the distance between the contour and the intersection of the vertical on the spindle at the farthest point on the corresponding point . Besides , Operator get_region_thickness Returns a histogram of area thickness . The length of the histogram corresponds to the maximum thickness that appears in the viewing area .
read_image(Image, 'fabrik')
get_image_size(Image, Width, Height)
auto_threshold(Image, Regions, 3 )
dev_open_window(0, 0, Width, Height, 'black', WindowHandle)
select_obj(Regions, RegSelect, 1)
get_region_thickness(RegSelect,Thickness, Histogramm)Only one area can be passed . If there are multiple connection components in this area , Only the first . All other components are ignored .
Such as in the figure above RegSelect It's like this . And obtained Thickness Just the first one alone region Enumeration of scan line widths of blocks .

2.5 hamming_distance
- hamming_distance(Regions1, Regions2 : : : Distance,
function : The Han Ming distance between the two regions .
operator hamming_distance Returns the Hamming distance between two regions , That is, the number of pixels in different regions ( distance ), That is, the number of pixels that one region contains but the other region does not :
Distance: distance

Similarity: Similarity coefficient
)
2.6 hamming_distance_norm
- hamming_distance_norm(Regions1, Regions2 : : Norm : Distance, Similarity)
function : Normalized Hamming distance between two regions .
Operator hamming_distance_norm Returns the Hamming distance between two regions , That is, the number of pixels in different regions ( distance ). Before calculating the difference ,Regions1 The region in is normalized to Regions2 Area in . The result is the number of pixels contained in one region but not in another :
2.7 hamming_change_region
hamming_change_region (Holes, OutputRegion, Width, Height, Error)
hamming_change_region Changed by Width and Height The region of the upper left part of a given image , The Hamming distance between the generated region and the input region is Distance. This is done by adding or removing distance points from the input area .
* Remove noise from a region
*
read_image (Caltab, 'caltab')
get_image_size (Caltab, Width, Height)
threshold (Caltab, Region, 0, 120)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions1, 'convexity', 'and', 0.9, 1)
select_shape (SelectedRegions1, SelectedRegions2, 'area', 'and', 200, 1000)
union1 (SelectedRegions2, Holes)
for Error := 1 to 10000 by 1000
* Change the region with the 'Error' hamming distance
hamming_change_region (Holes, OutputRegion, Width, Height, Error)
dev_clear_window ()
dev_set_color ('red')
dev_display (OutputRegion)
hamming_distance (Holes, OutputRegion, Distance1, Similarity1)
* Remove noise
remove_noise_region (OutputRegion, NoiseRed, 'n_4')
hamming_distance (Holes, NoiseRed, Distance2, Similarity2)
dev_set_color ('green')
dev_display (NoiseRed)
stop ()
endfor2.8 inner_circle
function : The largest circle inside an area .
- inner_circle(Regions : : : Row, Column, Radius)
Get the inner maximum inscribed circle of the area .
2.9 inner_rectangle1
function : The largest rectangle inside an area .
- inner_rectangle1(Regions : : : Row1, Column1, Row2, Column2)
The largest rectangle inside the area , The rectangular edge is parallel to the window .
2.10 moments_region_2nd
function : Moment properties of the region .
- moments_region_2nd(Regions : : : M11, M20, M02, Ia, Ib)
moment_region_2nd Calculation Regions Enter the geometric moment of the region in M11、M20 and M02. Besides , The major axis and minor axis of the input field are in Ia and Ib Calculates and returns . The covariance matrix is given by :

2 The order row correlation moment is at M20 Back in ,2 The order correlation moment is M02 Back in . Moment M11 Represents the covariance between the row and column coordinates of the region point .
r0 and c0 It's a region R The center of gravity coordinates of . Then the moment is defined as :


2.11 moments_region_2nd_invar
function : A moment characteristic of a region .
- moments_region_2nd_invar(Regions : : : M11, M20, M02)
Operator moment_region_2nd_invar Calculate the scaling moment of the axis (M20, M02) And passing parallel to the coordinate axis (M11) The inertia coefficient of the axis at the center of .
Z0 and S0 It's a region R The center and area of F Coordinates of .Mij Then the moment is defined as :

among Z and S Is the coordinates of all points in the region .
2.12 moments_region_2nd_rel_invar
function : Calculate the parameters of the correlation moment .
- moments_region_2nd_rel_invar(Regions : : : PHI1, PHI2)
Operator moment_region_2nd_rel_invar Calculate the relative moment of scaling (PHI1, PHI2).
Moment PHI1 and PHI2 Defined as :
![]()
If more than one region is passed , The results are stored in tuples , The index of the value in the tuple corresponds to the index of the region in the input .
In the case of blank areas , If no other behavior is set , Then the values of all parameters are 0.0( See set_system).
边栏推荐
- Siyuan notes: can you provide shortcut keys for folding all titles on the page?
- What is the difference between real-time rendering and pre rendering
- Mysql8 error: error 1410 (42000): you are not allowed to create a user with grant solution
- 19:00 p.m. tonight, knowledge empowerment phase 2 live broadcast - control panel interface design of openharmony smart home project
- RT-Thread 堆區大小設置
- 抖快B为啥做不好综艺
- 腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?
- 牛客网:乘积为正数的最长连续子数组
- MySQL master-slave configuration
- 居家办公浅谈远程协助快速提效心得 | 社区征文
猜你喜欢

牛客网:有多少个不同的二叉搜索树

Go zero micro Service Practice Series (VIII. How to handle tens of thousands of order requests per second)

快照和备份

JS ES5也可以创建常量?

中国传奇教授李泽湘,正在批量制造独角兽
![[unity ugui] scrollrect dynamically scales the grid size and automatically locates the middle grid](/img/c9/ff22a30a638b5d9743d39e22ead647.png)
[unity ugui] scrollrect dynamically scales the grid size and automatically locates the middle grid

MySQL transaction / lock / log summary

观测云与 TDengine 达成深度合作,优化企业上云体验

【机器学习】K-means聚类分析
Mysql8.0 method and steps for enabling remote connection permission
随机推荐
In depth analysis of the core code of the gadgetinspector
Policy Center-User Data
[CVE-2019-0193] - Apache Solr DataImport 远程命令执行分析
Unsupported major.minor version 52.0
技不压身,快速入门ETH智能合约开发,带你进入ETH世界
2022新消费半年盘点:行业遇冷,但这九个赛道依然吸金
今晚19:00知识赋能第2期直播丨OpenHarmony智能家居项目之控制面板界面设计
I implement "stack" with C I
KDD 2022 | how far are we from the general pre training recommendation model? Universal sequence representation learning model unisrec for recommender system
如何得到股票开户的优惠活动?在线开户安全么?
【Unity UGUI】ScrollRect 动态缩放格子大小,自动定位到中间的格子
RTP 发送PS流零拷贝方案
Carry two load balancing notes and find them in the future
思源笔记:能否提供页面内折叠所有标题的快捷键?
云和恩墨中标天津滨海农村商业银行2022-2023年度Oracle维保项目
牛客网:最小花费爬楼梯
The image variables in the Halcon variable window are not displayed, and it is useless to restart the software and the computer
What role does "low code" play in enterprise digital transformation?
Policy Center > Google Play‘s Target API Level Policy
Google play index table