当前位置:网站首页>halcon之区域:多种区域(Region)特征(5)
halcon之区域:多种区域(Region)特征(5)
2022-06-26 16:57:00 【无水先生】
一、提要
某些区域生成,初学者需要每个都试试,这不仅是个加强映像问题,而且是了解Halcon能力的过程。本篇介绍几个在数值图像分析中,较为有用的区域算子。请学友们共享!
本篇专门针对区域的属性这个特征进行实验验证。与前几篇是一个系列,包括:
halcon之区域:get_region_chain和get_region_contour_
二、区域的特征
2.1 area_center区域中心
- area_center: 功能:一个区域的面积(大小)和中心。
area_center(regin, ares,Row1, Column1)
set_color(3600,'red')
read_image (Image, 'f:/images/DOTS/block.jpg')
rgb1_to_gray(Image,gray)
get_image_size(gray,width,height)
fast_threshold (gray,regin,0, 50 , 7)
area_center(regin,ares,Row1, Column1)
2.2 circularity计算圆度
- circularity:功能:影响一个区域与圆的相似度的形状系数。
circularity(regin, Circularity)
圆度范围:0-1
set_color(3600,'red')
read_image (Image, 'f:/images/DOTS/many_block.jpg')
rgb1_to_gray(Image,gray)
get_image_size(gray,width,height)
fast_threshold (gray,regin,0, 50 , 7)
connection(regin, ConnectedRegions)
circularity(ConnectedRegions, Circularity)
圆度分别为:0.395611、0.64085、0.949253、0.529871;从视觉角度似乎一致。
2.3. compactness紧密度
- compactness:功能:影响一个区域致密度的形状系数。
紧密度:3.43204、1.25161、1.10005、2.074
紧密度和圆度类似,而且,圆的紧密度最高。
2.4. connect and_holes连接和孔的数量
功能:连接部分和中断的数目。
connect_and_holes(regin, NumConnected, NumHoles)
set_color(3600,'red')
read_image (Image, 'f:/images/DOTS/block.jpg')
rgb1_to_gray(Image,gray)
get_image_size(gray,width,height)
fast_threshold (gray,regin,0, 50 , 7)
connect_and_holes(regin, NumConnected, NumHoles)
连接为2,孔洞为2的图如下。
2.5. contlength获取区域外轮廓长度
功能:描述一个区域轮廓(contour)的长度。
contlength(regin,ContLength)
这里注意,大家去验证,gen_contour_region_xld和contlength(regin, ContLength)两种求外轮廓长度不一致:
gen_contour_region_xld (regin, Contours, 'border')
contlength(regin, ContLength)
2.6.区域的凸性
convexity 功能:影响一个区域凸性的形状系数。
结果:0.539397、0.991524、0.994038、0.72976,可以看到,圆和方凸性差不多。
2.7. diameter region
功能:一个区域两个边界点的最大距离。
diameter_region(ConnectedRegions,row1,col1,row2,col2,dim)
set_color(3600,'red')
read_image (Image, 'f:/images/DOTS/many_block.jpg')
rgb1_to_gray(Image,gray)
get_image_size(gray,width,height)
fast_threshold (gray,regin,0, 50 , 7)
connection(regin, ConnectedRegions)
diameter_region(ConnectedRegions,row1,col1,row2,col2,dim)
最大直径:161.608、155.013、151.743、132.91
2.8. eccentricity椭圆参数
功能:来源于椭圆参数的形状系数。
eccentricity(Regions : : : Anisometry, Bulkiness, StructureFactor)
显然 Anisometry是长短轴比例;以上A是实际测量的椭圆内像素面积。Bulkiness实际面积和理论面积比例。StructureFactor结构系数,
2.9. elliptic axis相似椭圆
功能:相似椭圆的参数。
2.10.euler_number欧拉数
功能:计算Euler数目。算子 euler_number 计算欧拉数,即连接组件数与孔数之差。
比如:下图的空洞(背景算空洞),是绿色字编号;前景的连接体是四个黑区;因此欧拉数为:
Number(黑连接4个)- 空洞(白的5个)=-1
边栏推荐
- Teach you to learn dapr - 8 binding
- Turtle cartography
- Daily record 2
- 直播预告|程序员进击,如何提升研发效能?6月21日晚视频号、B站同步直播,不见不散!
- Find all primes less than or equal to Lim, store them in AA array, and return the number of primes
- Leetcode HOT100 (22--- bracket generation)
- Day10 daily 3 questions (3): String Matching in array
- Cache breakdown! Don't even know how to write code???
- Microservice architecture practice: business management background and SSO design, SSO client design
- 防火 疏散 自救…这场安全生产暨消防培训干货满满!
猜你喜欢
She said she was tired! So tired! I want to change my career
Memory partition model
Distributed Architecture Overview
Programmer's essential toolkit, please collect!
[suggested collection] 11 online communities suitable for programmers
Teach you to learn dapr - 2 Must know concept
Getting started with mongodb
Over the weekend: 20000 words! Summary of JVM core knowledge, 18 serial cannons as a gift
Can Luo Yonghao succeed in entering the AR field this time?
玩转Linux,轻松安装配置MySQL
随机推荐
Community ownership of NFT trading market is unstoppable
SIGIR 2022 | 港大等提出超图对比学习在推荐系统中的应用
【万字总结】以终为始,详细分析高考志愿该怎么填
Romance of the Three Kingdoms: responsibility chain model
Deployment and operation of mongodb partitioned cluster
Teach you to learn dapr - 9 Observability
Day10 daily 3 questions (3): String Matching in array
Teach you to learn dapr - 6 Publish subscription
建立自己的网站(16)
进军AR领域,这一次罗永浩能成吗?
Discussion: the next generation of stable coins
What is the difference between digital collections and NFT
She said she was tired! So tired! I want to change my career
[recommendation system learning] technology stack of recommendation system
Teach you to learn dapr - 5 Status management
Screenshot of the answers to C language exercises
Use middleware to record slow laravel requests
Find out the maximum value of each column element of NxN matrix and store it in the one-dimensional array indicated by formal parameter B in order
The student record consists of student number and academic performance. The data of n students have been stored in the a structure array to find out the student record with the lowest performance
【MATLAB项目实战】基于卷积神经网络与双向长短时(CNN-LSTM)融合的锂离子电池剩余使用寿命预测