How to convert from cv :: Mat to CvArr?

I searched many times how to convert from cv :: Mat or CvMat to CvArr, but without amplification, please help me with this, thanks.

+5
source share
5 answers

When I need to do this, I just use:

IplImage tmp = image;

With the image of the variable Mat.

+4
source
Mat img = imread("C:\MyPic.jpg",CV_LOAD_IMAGE_GRAYSCALE);
IplImage tmp=img;
cvErode(&tmp, &tmp, 0, 2);
Mat laser=&tmp;
    imshow("Eroded",laser);

I converted cv::Matto CvArrthat way. Instead of using tmpdirectly use &tmp.

+3
source

? , , . , cvMorphologyEx CvArr, morphologyEx cv::Mat.

+1

If I remember correctly, CvMat IS is CvArr, so you can just pass it to CvArr, and the first bytes of CvArr now pass to the function that it is actually CvMat: http://opencv.willowgarage.com/documentation/basic_structures.html#cvarr

0
source

convert the image first using the following:

IplImage* oldstyleimg = &matimg.operator IplImage()

I don’t remember if he only creates a title for the image or creates a copy

0
source

All Articles