Opencv:如何获取然后更改“Mat vector”的值

时间:2014-10-16 00:50:06

标签: c++ opencv

我想做这样的操作但是我无法获取矢量Mat的值并更改它们。表顺便说一下,这是一维数组。谢谢。

vector<Mat> orjchannel; 
vector<Mat> refchannel; 

// There are some functions here 

for (int i = 0; i < 512; i++){
    for (int j = 0; j < 512; j++){
        double value = refchannel[i][j]; // This part does not work 
        orjchannel[i][j] = tables[value];

1 个答案:

答案 0 :(得分:3)

使用OpenCV,您通常使用at<DATATYPE>(r,c)命令访问Mat的值。例如......

// Mat constructor
Mat data(4, 1, CV_64FC1);

// Set Value
data.at<double>(0,0) = 4;

// Get Value
double value = data.at<double>(0,0);