Always use hal::dft in crossCorr function
This commit is contained in:
parent
008abd28fd
commit
15783cf668
@ -747,15 +747,11 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
|
|||||||
}
|
}
|
||||||
borderType |= BORDER_ISOLATED;
|
borderType |= BORDER_ISOLATED;
|
||||||
|
|
||||||
bool useHalDft = tileCount > 1;
|
|
||||||
hal::DftContext cF, cR;
|
hal::DftContext cF, cR;
|
||||||
if (useHalDft)
|
|
||||||
{
|
|
||||||
int f = CV_HAL_DFT_IS_INPLACE;
|
int f = CV_HAL_DFT_IS_INPLACE;
|
||||||
int f_inv = f | CV_HAL_DFT_INVERSE | CV_HAL_DFT_SCALE;
|
int f_inv = f | CV_HAL_DFT_INVERSE | CV_HAL_DFT_SCALE;
|
||||||
hal::dftInit2D(cF, dftsize.width, dftsize.height, maxDepth, 1, 1, f, blocksize.height + templ.rows - 1);
|
hal::dftInit2D(cF, dftsize.width, dftsize.height, maxDepth, 1, 1, f, blocksize.height + templ.rows - 1);
|
||||||
hal::dftInit2D(cR, dftsize.width, dftsize.height, maxDepth, 1, 1, f_inv, blocksize.height);
|
hal::dftInit2D(cR, dftsize.width, dftsize.height, maxDepth, 1, 1, f_inv, blocksize.height);
|
||||||
}
|
|
||||||
|
|
||||||
// calculate correlation by blocks
|
// calculate correlation by blocks
|
||||||
for( i = 0; i < tileCount; i++ )
|
for( i = 0; i < tileCount; i++ )
|
||||||
@ -794,7 +790,7 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
|
|||||||
copyMakeBorder(dst1, dst, y1-y0, dst.rows-dst1.rows-(y1-y0),
|
copyMakeBorder(dst1, dst, y1-y0, dst.rows-dst1.rows-(y1-y0),
|
||||||
x1-x0, dst.cols-dst1.cols-(x1-x0), borderType);
|
x1-x0, dst.cols-dst1.cols-(x1-x0), borderType);
|
||||||
|
|
||||||
if (useHalDft && bsz.height == blocksize.height)
|
if (bsz.height == blocksize.height)
|
||||||
hal::dftRun2D(cF, dftImg.data, (int)dftImg.step, dftImg.data, (int)dftImg.step);
|
hal::dftRun2D(cF, dftImg.data, (int)dftImg.step, dftImg.data, (int)dftImg.step);
|
||||||
else
|
else
|
||||||
dft( dftImg, dftImg, 0, dsz.height );
|
dft( dftImg, dftImg, 0, dsz.height );
|
||||||
@ -803,7 +799,7 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
|
|||||||
dftsize.width, dftsize.height));
|
dftsize.width, dftsize.height));
|
||||||
mulSpectrums(dftImg, dftTempl1, dftImg, 0, true);
|
mulSpectrums(dftImg, dftTempl1, dftImg, 0, true);
|
||||||
|
|
||||||
if (useHalDft && bsz.height == blocksize.height)
|
if (bsz.height == blocksize.height)
|
||||||
hal::dftRun2D(cR, dftImg.data, (int)dftImg.step, dftImg.data, (int)dftImg.step);
|
hal::dftRun2D(cR, dftImg.data, (int)dftImg.step, dftImg.data, (int)dftImg.step);
|
||||||
else
|
else
|
||||||
dft( dftImg, dftImg, DFT_INVERSE + DFT_SCALE, bsz.height );
|
dft( dftImg, dftImg, DFT_INVERSE + DFT_SCALE, bsz.height );
|
||||||
@ -838,12 +834,9 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (useHalDft)
|
|
||||||
{
|
|
||||||
hal::dftFree2D(cF);
|
hal::dftFree2D(cF);
|
||||||
hal::dftFree2D(cR);
|
hal::dftFree2D(cR);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void matchTemplateMask( InputArray _img, InputArray _templ, OutputArray _result, int method, InputArray _mask )
|
static void matchTemplateMask( InputArray _img, InputArray _templ, OutputArray _result, int method, InputArray _mask )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user