当前位置:网站首页>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).
边栏推荐
- Finally understand science! 200 pictures to appreciate the peak of human wisdom
- halcon知识:矩阵专题【02】
- Policy Center > Misrepresentation
- 新茶饮“死去活来”,供应商却“盆满钵满”?
- Google play index table
- 24:第三章:开发通行证服务:7:自定义异常(来表征程序中出现的错误);创建GraceExceptionHandler来全局统一处理异常(根据异常信息,构建对应的API统一返回对象的,JSON数据);
- 实时渲染和预渲染有什么区别
- 什么是XR扩展现实,XR云串流平台有哪些
- 【Verilog基础】关于Clock信号的一些概念总结(clock setup/hold、clock tree、clock skew、clock latency、clock transition..)
- Asp. NETCORE uses cache and AOP to prevent repeated commit
猜你喜欢

ArcMap operation series: 80 plane to latitude and longitude 84

RT thread heap size Setting

大学生研究生毕业找工作,该选择哪个方向?

赛芯电子冲刺科创板:拟募资6.2亿 实控人谭健为美国籍

'&lt;', hexadecimal value 0x3C, is an invalid 问题解决
![[BJDCTF2020]The mystery of ip|[CISCN2019 华东南赛区]Web11|SSTI注入](/img/c2/d6760826b81589781574aebff61f9a.png)
[BJDCTF2020]The mystery of ip|[CISCN2019 华东南赛区]Web11|SSTI注入

What is the difference between real-time rendering and pre rendering
![[bjdctf2020]the mystery of ip|[ciscn2019 southeast China division]web11|ssti injection](/img/c2/d6760826b81589781574aebff61f9a.png)
[bjdctf2020]the mystery of ip|[ciscn2019 southeast China division]web11|ssti injection

19:00 p.m. tonight, knowledge empowerment phase 2 live broadcast - control panel interface design of openharmony smart home project

Cloud XR, how to help industrial upgrading
随机推荐
POJ Project Summer
Three development trends of enterprise application viewed from the third technological revolution
Cesium-1.72 learning (add points, lines, cubes, etc.)
深入分析GadgetInspector核心代码
猎头5万挖我去VC
GaussDB创新特性解读:Partial Result Cache,通过缓存中间结果对算子进行加速
【牛客网刷题系列 之 Verilog快速入门】~ 位拆分与运算
Two methods for MySQL to open remote connection permission
[unity ugui] scrollrect dynamically scales the grid size and automatically locates the middle grid
[附下载]渗透测试神器Nessus安装及使用
云技能提升好伙伴,亚马逊云师兄今天正式营业
Headhunter 50, 000, I'll go to VC
Li Zexiang, a legendary Chinese professor, is making unicorns in batches
备战数学建模34-BP神经网络预测2
RT thread heap size Setting
荣盛生物冲刺科创板:拟募资12.5亿 年营收2.6亿
Cesium-1.72 learning (earth model creation online offline tile)
Build cloud native observability capability suitable for organizations
Tencent two sides: @bean and @component are used on the same class. What happens?
【Unity UGUI】ScrollRect 动态缩放格子大小,自动定位到中间的格子