开发者

Create a CvMat object from an IplImage

开发者 https://www.devze.com 2023-03-30 06:01 出处:网络
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 cvBoundingR

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.


cvBoundingRect dose not take a image as parameter but a point set. It seems you should firstly generate a point set from your image and then call cvBoundingRect.

To get CvMat header from a IplImage, you can do as Kamaev has answered.

0

精彩评论

暂无评论...
验证码 换一张
取 消