Hi, guys.
I migrate opencv 3.0.0 recently. After the migration, the accumulate() in the following line throw an exception.
> int sizes[] = {1, 512, 1024};> cv::Mat mat1(3, sizes, CV_32F, cv::Scalar(1);> cv::Mat mat2(mat.dims, mat1.row(0).sizes(), CV_32F, cv::Scalar(0));> for (int y = 0; y < 3; y ++) accumulate(mat1.row(y), mat2);
I changed the mat1's dimensions from 3 to 2 by `squeeze()` then there was no exception.
Before the migration, the OpenCV's version is 2.4.9 and this codes works well.
I read the documentation of `accumulate()` in opencv 3.0.0.
And it gives this function:
> dst(x,y) = dst(x,y) + src(x,y) if mask != 0
Does this mean `accumulate()` in OpenCV 3.0.0 does not support 3d mat any more?
What is the best practices if I want to accumulate the 3d Mat?
Thanks :)
Update:
The matrix's dimension is 1x512x512. Then I used `mat.squeeze()` to get a 2d matrix to solve this problem.
But I feel it's not efficient because the `mat.squeeze()` is called in the loop.
I wonder if there is another way to solve this problem.
↧