From 32630dbf6144ca73b124e23c9e79c887baaa2de2 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 4 Oct 2013 13:51:58 +0400 Subject: [PATCH] Adapt cap_openni.cpp to the new Ptr. --- modules/highgui/src/cap_openni.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/highgui/src/cap_openni.cpp b/modules/highgui/src/cap_openni.cpp index 1ca140634a..d8ef7355ae 100644 --- a/modules/highgui/src/cap_openni.cpp +++ b/modules/highgui/src/cap_openni.cpp @@ -270,13 +270,13 @@ private: virtual inline void pushDepthMetaData( xn::DepthMetaData& depthMetaData ) { - cv::Ptr depthPtr = new xn::DepthMetaData; + cv::Ptr depthPtr = cv::makePtr(); depthPtr->CopyFrom(depthMetaData); depthQueue.push(depthPtr); } virtual inline void pushImageMetaData( xn::ImageMetaData& imageMetaData ) { - cv::Ptr imagePtr = new xn::ImageMetaData; + cv::Ptr imagePtr = cv::makePtr(); imagePtr->CopyFrom(imageMetaData); imageQueue.push(imagePtr); } @@ -329,7 +329,7 @@ private: virtual inline void pushDepthMetaData( xn::DepthMetaData& depthMetaData ) { - cv::Ptr depthPtr = new xn::DepthMetaData, tmp; + cv::Ptr depthPtr = cv::makePtr(), tmp; depthPtr->CopyFrom(depthMetaData); tbb::mutex mtx; @@ -347,7 +347,7 @@ private: virtual inline void pushImageMetaData( xn::ImageMetaData& imageMetaData ) { - cv::Ptr imagePtr = new xn::ImageMetaData, tmp; + cv::Ptr imagePtr = cv::makePtr(), tmp; imagePtr->CopyFrom(imageMetaData); tbb::mutex mtx; @@ -872,7 +872,7 @@ bool CvCapture_OpenNI::setCommonProperty( int propIdx, double propValue ) // start synchronization if( approxSyncGrabber.empty() ) { - approxSyncGrabber = new ApproximateSyncGrabber( context, depthGenerator, imageGenerator, maxBufferSize, isCircleBuffer, maxTimeDuration ); + approxSyncGrabber.reset(new ApproximateSyncGrabber( context, depthGenerator, imageGenerator, maxBufferSize, isCircleBuffer, maxTimeDuration )); } else { @@ -1175,8 +1175,8 @@ IplImage* CvCapture_OpenNI::retrievePointCloudMap() int cols = depthMetaData.XRes(), rows = depthMetaData.YRes(); cv::Mat pointCloud_XYZ( rows, cols, CV_32FC3, cv::Scalar::all(badPoint) ); - cv::Ptr proj = new XnPoint3D[cols*rows]; - cv::Ptr real = new XnPoint3D[cols*rows]; + std::vector proj(cols*rows); + std::vector real(cols*rows); for( int y = 0; y < rows; y++ ) { for( int x = 0; x < cols; x++ ) @@ -1187,7 +1187,7 @@ IplImage* CvCapture_OpenNI::retrievePointCloudMap() proj[ind].Z = depth.at(y, x); } } - depthGenerator.ConvertProjectiveToRealWorld(cols*rows, proj, real); + depthGenerator.ConvertProjectiveToRealWorld(cols*rows, &proj.front(), &real.front()); for( int y = 0; y < rows; y++ ) {