我正在尝试在 OpenCV 中使用 4 维矩阵,初始化部分如下所示:
int feature_points_size[] = {bincellDim.x , bincellDim.y , bincellDim.z , 100};
feature_points.create(4 , feature_points_size , CV_64F);
但库不允许我像这样使用“at”访问 feature_points 的元素:
feature_points.at<double>(k , j , i , l) = stickfea_code.at<double>(l , 0);
feature_points.at<double>(k , j , i , l + 50) = countfea_code.at<double>(l , 0);
似乎 Mat.at<> 没有 4 个输入的版本 访问它的元素的最佳做法是什么?
提前致谢!
最佳答案
cv::Mat::at<>
确实,实际上有一个 n-dim 过载,你需要使用 T& Mat::at(const int* idx)
版本。
或者,只需为它编写您自己的(外部)包装器,您可以像这样使用它:
at4D<double>(feature_points,k,j,i,l);
关于c++ - 我如何访问 OpenCV 中的高维矩阵元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30451204/