I'm using OpenCV in C++ to create a multidimensional mat (to use as an accumulator) over an image.
I create the 3d accumulator like this:
const int accumSize[] = {sx, sy, sr};
cv::Mat accum(3, accumSize, CV_64F, cv::Scalar::all(0));
I need to extract an n*n*n
ROI from this accumulator so I can get the maximum within each ROI using cv::minMaxIdx
.
Since this is 3d, the usual method of using a cv::Rect
to get the ROI doesn't work. Nor does:
accum(cv::Range(x1,x2), cv::Range(y1,y2), cv::Range(r1,r2));
Anyone know how to easily get a 3d submatrix without having to explicitly allocate it and copy element by element?