访问 opencv 矩阵CV_32S元素
Access opencv matrix CV_32S element
如果我有一个类型为CV_32SC1
的矩阵,我应该在函数Mat::at
中使用什么类型名?
例如
Mat X; // for example eye matrix of size 10,10,and type CV_32SC1
X.at<??????>(1,1)=5;
如何找到其他矩阵类型的类型名?
OpenCV 中矩阵类型名的一般规则是:
CV_<bit_depth>(S|U|F)C<number_of_channels>
S = Signed integer
U = Unsigned integer
F = Float
因此,根据您拥有的先前字母(S,U,F)之一,您将投<int>
,<unsigned integer>
或<float>
。
CV_32SC1是有符号 1 位整数的 32 通道,那么我认为X.at<int>()
应该这样做。
Mat已经"知道"如何处理像素,该类型只是将位转换为表达式计算所需的C++值。
我在这里找到了一些关于符号的解释。
相关文章:
- Mongodb c++驱动程序:如何查询元素的数组
- 将数组作为参数传递给函数安全吗?作为第三方职能部门,可以探索他们想要的之外的其他元素
- 使用strcpy将char数组的元素复制到另一个数组
- 使用不带参数的函数访问结构元素
- 给定n个元素的m个集合.在C++中找到出现在最大集合数中的元素
- C++如何通过用户输入删除列表元素
- lower_bound()返回最后一个元素
- 基于多个条件处理地图中的所有元素
- 调整大小后指向元素值的指针unordered_map有效?
- 使用std::transform将一个范围的元素添加到另一个范围中
- 使用函数"remove"删除重复元素
- 具有最大子序列大小的序列,每个元素都相同
- 如何将两个不同矢量的同一位置的两个元素组合在一起
- 如何将元素添加到数组的线程安全函数?
- 有没有办法将谓词中的元素偏移量传递给 std 算法?
- 我想访问std::unique_ptr中的一个特定元素
- 如何通过 getter 函数删除矢量的元素?
- 向量元素的引用地址与它所指向的向量元素的地址不同.为什么
- 从控制台中删除最后打印的元素
- 擦除while循环中迭代的元素