javascript - Access 4d matrix JS opencv
问题描述
I'm using electron with openCV with opencv4nodejs.
I have a 4d
Matrix object and I want to access the 4 dimension elements of this matrix. The at
function is not working: mat.at(0,0,0,1)
is equal to mat.at(0,0,0,2)
and they are both equal to mat.at(0,0,0,0)
which I know is the true value.
This makes sense since the openCV c++ matrix documentation shows that at
function can get at most 3 parameters int i0, int i1, int i2
.
How do I access the 4d
elements in a matrix?
Thanks in advance
解决方案
In order to access any element in dimension higher than 3d
you will need to use the at
function and pass it an array. Here is the formal c++ documentation of the function.
For example:
var element1234 = myMatrix.at([1, 2, 3, 4]);
Will work.
推荐阅读
- python - Python PUT 请求,发送 int 而不是 string
- python - 使用 Pony ORM 或 sqlalchemy 时,在哪里创建数据库对象?
- html - 如何使用 flex 将图像与 div 的底部对齐?
- java - 试图将图像添加到 JFrame
- javascript - 当元素被禁用时 v-tooltip 停止工作
- jquery - 遍历元素循环时如何检查文本
- java - AES 加密 C# -> Java
- ios - 为什么我的 UIImageView 的框架大于屏幕尺寸?
- angular - WDS 断开连接!在 Firefox Angular 7 的控制台中
- sql - 如何过滤我的表以在 Oracle 中显示结果?