Ask Your Question

stbnps's profile - activity

2016-05-21 08:44:28 -0600 received badge  Student (source)
2014-02-06 19:03:36 -0600 received badge  Editor (source)
2014-02-06 19:03:07 -0600 asked a question Slicing 3d matrix

I have a Mat like this:

int sizes[] = { 5, 5, 5 };
Mat a(3, sizes, CV_8UC1, cv::Scalar(0));

I want to get a sub-matrix in some specified plane (X-Y, X-Z, or Y-Z) and apply a distance transform to that matrix. I tried something like:

Range ranges[] = {Range(0, 1), Range::all(), Range::all()};
Mat b(a, ranges);

But when I perform:

distanceTransform(b, c, CV_DIST_L2, CV_DIST_MASK_PRECISE);

I got this error:

OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type)

I gess that's because the program doesn't slice the 3d matrix properly.

I also looked at NAryMatIterator but it doesnt seem to be what I need.

Thanks!