当前位置:网站首页>halcon知识:矩阵专题【01】
halcon知识:矩阵专题【01】
2022-06-28 17:28:00 【无水先生】
一、提要
本文聊聊Halcon的矩阵操作。在做一些实验的时候,常常用matlab方便,其实,熟悉halcon的学者,也可用halcon实现常规的数学实验。本人认为halcon是一个很丰富的资源,甚至超过Opencv,专门挤出时间研究halcon的矩阵是非常核算的付出。
二、矩阵相关算子
2.1 矩阵如何创建
create_matrix( : : Rows, Columns, Value : MatrixID)
参数表:( : : Rows-矩阵行数, Columns-矩阵列数, Value-矩阵元素值元组 : MatrixID-矩阵索引号)
说明:这里创建矩阵,要求将矩阵所有元素确定地传进,其格式为1X(rows*columns)维度。
Rows:=4
Cols:=4
Value:=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
create_matrix(Rows,Cols,Value,MatrixID )2.2 矩阵元素的读取
get_value_matrix( : : MatrixID, Row, Column : Value)
参数表:( : : MatrixID--矩阵的索引号, Row--用tuple指定的多行, Column--用tuple指定的多列 : Value--用tuple指定的输出)
另一种情况,如果只访问一个值,那么Row, Column以数量形式给出就可以了
说明:参考示例
1)访问一个值
get_value_matrix( MatrixID, 5, 7 ,Value) *Value中获得5行7列的值
2)访问多个值

2.3 获取矩阵大小
get_size_matrix(matrix_id,rows,cols)
2.4 创建对角矩阵或获取矩阵的对角元素
运算符 get_diagonal_matrix 生成一个新的矩阵 Vector 并将 Matrix 的对角元素复制到这个新矩阵。矩阵由矩阵句柄 MatrixID 定义。矩阵向量具有一列和 n 行,其中 n = 对角线元素的数量。运算符返回矩阵 Vector 的矩阵句柄 VectorID。可以访问矩阵的元素,例如使用运算符。
1 对于方阵
方阵的对角线有第0、-1、1、-2、2...个如:

2 非方阵矩阵

2.5 得到矩阵的全部元素
- get_full_matrix(MatrixID, Values)
将全部矩阵的元素获取出来:

2.6 得到矩阵的子矩阵
- get_sub_matrix( : : MatrixID, Row, Column, RowsSub, ColumnsSub : MatrixSubID)
得到MatrixID矩阵中,以Row, Column开始单元的, RowsSub个行, ColumnsSub个列的子矩阵。
2.7 设置矩阵元素值
- set_value_matrix(matrix_1_id,1,1,-10)
此语句将矩阵matrix_1_id的1行1列赋值为-10
2.8 设置整个矩阵元素值
- set_full_matrix(matrix_1_id,1)
此句将整个矩阵matrix_1_id元素刷新为1.
2.9 求逆矩阵
- invert_matrix( : : MatrixID, MatrixType, Epsilon : MatrixInvID)
运算符 invert_matrix 计算由矩阵句柄 MatrixID 定义的矩阵的逆矩阵。使用结果生成一个新矩阵 MatrixInv,并返回该矩阵的矩阵句柄 MatrixInvID。可以用get_full_matrix访问矩阵的元素。
对于 Epsilon = 0,计算倒数。可以通过 MatrixType 选择 Matrix 的类型。支持以下值:“general”表示一般,“symmetric”表示对称,“positive_defined”表示对称正定,“tridiagonal”表示三对角线,“upper_triangular”表示上三角,“permuted_upper_triangular”表示置换上三角,“lower_triangular”用于下三角矩阵,'permuted_lower_triangular' 用于置换下三角矩阵。

对于 Epsilon > 0,使用奇异值分解 (SVD) 计算伪逆。在计算过程中,所有小于 Epsilon * 最大奇异值的奇异值都设置为 0。对于这些值,不进行内部除法以防止被零除。如果使用 SVD 算法计算方阵,则计算需要更多时间。矩阵的类型必须设置为 MatrixType = 'general'。

2.10 取矩阵的逆
invert_matrix_mod
运算符 invert_matrix_mod 计算由矩阵句柄 MatrixID 定义的矩阵的逆矩阵。
输入矩阵被结果覆盖。可以访问矩阵的元素,例如使用运算符 get_full_matrix。
其它内容同invert_matrix。
边栏推荐
- NoSQL之Redis配置与优化(你不在南京的日子我替你吹了秦淮河的晚风)
- 数据源只能连阿里云的云数据库吗?阿里云服务器里装的数据库连不上嘛?
- Stackoverflow 2022 developer report: PostgreSQL surpasses MySQL!
- NP tips: random create random matrix sample = np random. random([19, 64 , 64, 3])
- Gestion des journaux sauvegarde et récupération des journaux dans MySQL
- NoSQL redis configuration and optimization (I blew the night breeze of Qinhuai River for you when you were not in Nanjing)
- 2022年化工自动化控制仪表考试模拟100题模拟考试平台操作
- How to make your WordPress website more secure
- 全网最全360无死角编写软件测试用例模板【建议收藏】
- Squid代理服务器应用(我从远方赶来,赴你一面之约)
猜你喜欢

MCU modifies network hardware driver (PHY chip replacement)

Node foundation ~ node level
![[dark horse morning post] Tencent responded that a large number of users' QQ numbers were stolen; Weiya's husband company was fined 190000 yuan; China Evergrande is applied for liquidation; Guanxiaoto](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[dark horse morning post] Tencent responded that a large number of users' QQ numbers were stolen; Weiya's husband company was fined 190000 yuan; China Evergrande is applied for liquidation; Guanxiaoto

How to do a good job of gateway high availability protection in the big promotion scenario

第四个专栏,Kubernetes云原生实战,它来了~
![[official cooperation between Shang Silicon Valley and Tencent cloud] video release of Silicon Valley classroom project](/img/06/b786166317f2d66e1c61133f427630.jpg)
[official cooperation between Shang Silicon Valley and Tencent cloud] video release of Silicon Valley classroom project

NoSQL redis configuration and optimization (I blew the night breeze of Qinhuai River for you when you were not in Nanjing)

Time effective simulation platform based on dataworks | acquisition technology

Squid proxy server application (I came from afar to make an appointment with you)

CSDN Blogger
随机推荐
MySQL中的日志管理 日志備份與恢複
CSDN Blogger
dataworks SQL脚本支持语句块的if else 判断吗
Node foundation ~ node level
强化学习在黄页商家智能聊天助手中的探索实践
Introduction to PMD source code analyzer
2022 chemical automation control instrument test simulation 100 questions simulation test platform operation
问下 flink sql cdc. 能同步多张表然后sink到一份表中么 同步的表通过 joi
ICML 2022 | transferable imitation learning method based on decoupling gradient optimization
[question skimming diary] and a subarray of K
国内怎么就做不出 IDEA 那样的产品?
IP problem occurs when a virtual system is cloned in VirtualBox
传统运维不得不会的zabbix监控(你早起,我早起,我们迟早在一起)
Large scale sports events and crime risks
How to make your WordPress website more secure
How to back up a WordPress database
Spruce network deepflow helps 5g core network and telecom cloud build observability
rsync 远程同步(日落尤其温柔的人间皆是浪漫)
Xiaoxin black apple sound card ID injection
全力冲unreal了