how to change the following code into new opencv c++ api. convert Iplimage* into mat and how to convert cvCreateImage into mat

asked 2019-11-11 02:49:14 -0500

Gilal Nauman gravatar image

updated 2019-11-11 03:08:53 -0500

LBerger gravatar image

convert Iplimage* into mat and how to convert cvCreateImage into mat

IplImage* frame = NULL;
IplImage* frame_img = NULL;
IplImage* background_img = NULL;

background_img = cvCreateImage(cvSize(frame->width, frame->height),IPL_DEPTH_8U,1);
frame_img = cvCreateImage(cvSize(frame->width, frame->height),IPL_DEPTH_8U,1);
background_mat = cvCreateMat(frame->height, frame->width, CV_32FC1);
cvRunningAvg(vid_frame,BkImg, 0.005, NULL);
cvConvertScale(BkImg,FrImg, 1.0, 0.0);
cvDilate(Temp_img4,Temp_img4, 0, 5);
cvErode(Temp_img4,Temp_img4, 0, 2);
edit retag flag offensive close merge delete

Comments

IplImage* background_img = NULL; becomes Mat background_img(frame.rows, frame.cols, CV_8UC1) or Mat background_img(fSize(frame.cols,frame.rows),CV_8UC1);

LBerger gravatar imageLBerger ( 2019-11-11 03:10:42 -0500 )edit

sorry, but your code is incomplete, and does not make sense.

please try to find out first: WHAT DOES IT DO ?

most likely, the c++ replacement will NOT be a line by line translation..

berak gravatar imageberak ( 2019-11-11 03:29:16 -0500 )edit