diff --git a/modules/photo/src/inpaint.cpp b/modules/photo/src/inpaint.cpp index ec91e3c1bf..f91db5f545 100644 --- a/modules/photo/src/inpaint.cpp +++ b/modules/photo/src/inpaint.cpp @@ -718,7 +718,7 @@ icvNSInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQueue } namespace cv { -template<> void cv::Ptr::delete_obj() +template<> void cv::DefaultDeleter::operator ()(IplConvKernel* obj) const { cvReleaseStructuringElement(&obj); } @@ -759,11 +759,11 @@ cvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_i ecols = input_img->cols + 2; erows = input_img->rows + 2; - f = cvCreateMat(erows, ecols, CV_8UC1); - t = cvCreateMat(erows, ecols, CV_32FC1); - band = cvCreateMat(erows, ecols, CV_8UC1); - mask = cvCreateMat(erows, ecols, CV_8UC1); - el_cross = cvCreateStructuringElementEx(3,3,1,1,CV_SHAPE_CROSS,NULL); + f.reset(cvCreateMat(erows, ecols, CV_8UC1)); + t.reset(cvCreateMat(erows, ecols, CV_32FC1)); + band.reset(cvCreateMat(erows, ecols, CV_8UC1)); + mask.reset(cvCreateMat(erows, ecols, CV_8UC1)); + el_cross.reset(cvCreateStructuringElementEx(3,3,1,1,CV_SHAPE_CROSS,NULL)); cvCopy( input_img, output_img ); cvSet(mask,cvScalar(KNOWN,0,0,0)); @@ -772,7 +772,7 @@ cvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_i cvSet(f,cvScalar(KNOWN,0,0,0)); cvSet(t,cvScalar(1.0e6f,0,0,0)); cvDilate(mask,band,el_cross,1); // image with narrow band - Heap=new CvPriorityQueueFloat; + Heap=cv::makePtr(); if (!Heap->Init(band)) return; cvSub(band,mask,band,NULL); @@ -785,12 +785,12 @@ cvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_i if( flags == cv::INPAINT_TELEA ) { - out = cvCreateMat(erows, ecols, CV_8UC1); - el_range = cvCreateStructuringElementEx(2*range+1,2*range+1, - range,range,CV_SHAPE_RECT,NULL); + out.reset(cvCreateMat(erows, ecols, CV_8UC1)); + el_range.reset(cvCreateStructuringElementEx(2*range+1,2*range+1, + range,range,CV_SHAPE_RECT,NULL)); cvDilate(mask,out,el_range,1); cvSub(out,mask,out,NULL); - Out=new CvPriorityQueueFloat; + Out=cv::makePtr(); if (!Out->Init(out)) return; if (!Out->Add(band))