added ippiTrueDistanceTransform_8u32f_C1R

pull/2624/head
Elena Gvozdeva 11 years ago
parent 0265247504
commit b4830d896c
  1. 17
      modules/imgproc/src/distransform.cpp

@ -577,7 +577,7 @@ trueDistTrans( const Mat& src, Mat& dst )
for( ; i <= m*3; i++ ) for( ; i <= m*3; i++ )
sat_tab[i] = i - shift; sat_tab[i] = i - shift;
cv::parallel_for_(cv::Range(0, n), cv::DTColumnInvoker(&src, &dst, sat_tab, sqr_tab)); //dst.total()/(double)(1<<16) cv::parallel_for_(cv::Range(0, n), cv::DTColumnInvoker(&src, &dst, sat_tab, sqr_tab));
// stage 2: compute modified distance transform for each row // stage 2: compute modified distance transform for each row
float* inv_tab = sqr_tab + n; float* inv_tab = sqr_tab + n;
@ -732,21 +732,26 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
if( maskSize == CV_DIST_MASK_PRECISE ) if( maskSize == CV_DIST_MASK_PRECISE )
{ {
//ipp version is slower than the parallel in OpenCV
/*#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if ((currentParallelFramework()==NULL) || (src.total()<(int)(1<<16)))
{
IppStatus status; IppStatus status;
IppiSize roi = { src.cols, src.rows }; IppiSize roi = { src.cols, src.rows };
Ipp8u *pBuffer; Ipp8u *pBuffer;
int bufSize=0; int bufSize=0;
status = ippiTrueDistanceTransformGetBufferSize_8u32f_C1R(roi, &bufSize); status = ippiTrueDistanceTransformGetBufferSize_8u32f_C1R(roi, &bufSize);
if (status>=0)
{
pBuffer = ippsMalloc_8u( bufSize ); pBuffer = ippsMalloc_8u( bufSize );
status = ippiTrueDistanceTransform_8u32f_C1R(src.ptr<uchar>(),(int)src.step, dst.ptr<float>(), (int)dst.step, roi, pBuffer); status = ippiTrueDistanceTransform_8u32f_C1R(src.ptr<uchar>(),(int)src.step, dst.ptr<float>(), (int)dst.step, roi, pBuffer);
ippsFree( pBuffer ); ippsFree( pBuffer );
if (status>=0)
return; return;
}
#endif*/ }
#endif
trueDistTrans( src, dst ); trueDistTrans( src, dst );
return; return;

Loading…
Cancel
Save