I searched many times how to convert from cv :: Mat or CvMat to CvArr, but without amplification, please help me with this, thanks.
When I need to do this, I just use:
IplImage tmp = image;
With the image of the variable Mat.
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.
cv::Mat
CvArr
tmp
&tmp
? , , . , cvMorphologyEx CvArr, morphologyEx cv::Mat.
cvMorphologyEx
morphologyEx
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
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