Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to convert from cv::Mat to CvArr?

Tags:

c++

opencv

i have passed a lot of time searching on how to convert from cv::Mat or CvMat to CvArr but with no gain ,please help me in that,thanks.

like image 736
chostDevil Avatar asked Apr 22 '12 16:04

chostDevil


2 Answers

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::Mat to CvArr by this way. Instead of using tmp directly use &tmp.

like image 160
Vivek Mahto Avatar answered Nov 20 '22 05:11

Vivek Mahto


When I need to do that I just use :

IplImage tmp = image;

With image a Mat variable.

like image 4
Clement Roblot Avatar answered Nov 20 '22 03:11

Clement Roblot