Accessing elements of a cv::Mat with atlt;floatgt;(i, j). Is it (x,y) or (row,col)?(使用 atlt;floatgt;(i, j) 访问 cv::Mat 的元素.是 (x,y) 还是 (row,col)?)
问题描述
当我们访问 cv::Mat 结构的特定元素时,我们可以使用 mat.at(i,j) 来访问位置 i,j 的元素.然而,目前尚不清楚 (i,j) 是指矩阵中的 x,y 坐标,还是第 i 行和第 j 列.
When we access specific elements of a cv::Mat structure, we can use mat.at(i,j) to access the element at position i,j. What is not immediately clear, however, whether (i,j) refers to the x,y coordinate in the matrix, or the ith row and the jth column.
推荐答案
OpenCV 与其他库一样,按行优先顺序处理矩阵(和图像).这意味着每个访问都被定义为 (row, column)
.
OpenCV, like may other libraries, treat matrices (and images) in row-major order. That means every access is defined as (row, column)
.
此一般规则的显着例外是 Matlab 和 Eigen 库.
Notable exceptions from this general rule are Matlab and Eigen libraries.
这篇关于使用 at<float>(i, j) 访问 cv::Mat 的元素.是 (x,y) 还是 (row,col)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 at<float>(i, j) 访问 cv::Mat 的元素


基础教程推荐
- 我有静态或动态 boost 库吗? 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 这个宏可以转换成函数吗? 2022-01-01
- 常量变量在标题中不起作用 2021-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30