Iterate over multiple vectors of uneven Mat

asked 2016-01-21 09:47:27 -0600

podlipensky gravatar image

Hi,

I have two vectors with uneven Mat

vector<Mat> delta_nabla_w = GetWeightsMatDelta();  // [Mat(10, 20), Mat(20, 40), Mat(40, 10)]
vector<Mat> nabla_w = GetWeightsMatZeros(); // [Mat(10, 20), Mat(20, 40), Mat(40, 10)]

I need to iterate over both of them at the same time and sum them up. I've tried this:

for(int j = 0; j < nabla_w.size(); j++) {
     nabla_w.at<Mat>(j) += delta_nabla_w.at<Mat>(j);
}

But it gives me an error Mat does not refer to a value, which kind of make sense. Could you please help me on this one?

edit retag flag offensive close merge delete

Comments

wait, cv::Mat has a at<someType> but accessing the vector is still plain nabla_w.at(j) or even nabla_w[j]

berak gravatar imageberak ( 2016-01-21 10:01:51 -0600 )edit