访问在< float>(i,j)处的cv :: Mat的元素。是(x,y)还是(row,col)? [英] Accessing elements of a cv::Mat with at<float>(i, j). Is it (x,y) or (row,col)?

查看:192
本文介绍了访问在< float>(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和其他库一样,以行主要顺序处理矩阵(和图像)。这意味着每个acces都定义为(ROW,column)

OpenCV, like may other libraries, treat matrices (and images) in row-major order. That means every acces is defined as (ROW, column)

这个通用规则的一个明显例外是Matlab和Eigen(c / cpp矩阵库)。访问它们是先按列,然后按行。

Notable exceptions from this general rule ar Matlab and Eigen (c/cpp matrix library). Access to them is first by column, then by row.

这篇关于访问在< float>(i,j)处的cv :: Mat的元素。是(x,y)还是(row,col)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆