I am trying to create a bounding box around a feature in a binary image using OpenCV. I've read that if I create a CvRect object by passing a CvMat object as an argument to cvBoundingRect(), I can obtain the bounding box I seek. My problem is how do I create the CvMat from an IplImage. The line I'd like to use is:
CvMat *imageMatrix = cvCreateMat(int rows, int cols, int type);
but clearly that doesn't accept an IplImage as an input. Is there another way of creating a CvMat from an IplImage?
I think you are searching for cvGetMat function.