1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2019-07-02 21:17:45 +00:00
35 changed files with 467 additions and 540 deletions
+8 -11
View File
@@ -564,7 +564,6 @@ static bool ocl_matchTemplate( InputArray _img, InputArray _templ, OutputArray _
#include "opencv2/core/hal/hal.hpp"
void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
Size corrsize, int ctype,
Point anchor, double delta, int borderType )
{
const double blockScale = 4.5;
@@ -574,7 +573,7 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
Mat templ = _templ;
int depth = img.depth(), cn = img.channels();
int tdepth = templ.depth(), tcn = templ.channels();
int cdepth = CV_MAT_DEPTH(ctype), ccn = CV_MAT_CN(ctype);
int cdepth = corr.depth(), ccn = corr.channels();
CV_Assert( img.dims <= 2 && templ.dims <= 2 && corr.dims <= 2 );
@@ -585,13 +584,11 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
}
CV_Assert( depth == tdepth || tdepth == CV_32F);
CV_Assert( corrsize.height <= img.rows + templ.rows - 1 &&
corrsize.width <= img.cols + templ.cols - 1 );
CV_Assert( corr.rows <= img.rows + templ.rows - 1 &&
corr.cols <= img.cols + templ.cols - 1 );
CV_Assert( ccn == 1 || delta == 0 );
corr.create(corrsize, ctype);
int maxDepth = depth > CV_8S ? CV_64F : std::max(std::max(CV_32F, tdepth), cdepth);
Size blocksize, dftsize;
@@ -815,8 +812,8 @@ static void matchTemplateMask( InputArray _img, InputArray _templ, OutputArray _
Mat mask2_templ = templ.mul(mask2);
Mat corr(corrSize, CV_32F);
crossCorr( img, mask2_templ, corr, corr.size(), corr.type(), Point(0,0), 0, 0 );
crossCorr( img2, mask, result, result.size(), result.type(), Point(0,0), 0, 0 );
crossCorr( img, mask2_templ, corr, Point(0,0), 0, 0 );
crossCorr( img2, mask, result, Point(0,0), 0, 0 );
result -= corr * 2;
result += templSum2;
@@ -830,8 +827,8 @@ static void matchTemplateMask( InputArray _img, InputArray _templ, OutputArray _
}
Mat corr(corrSize, CV_32F);
crossCorr( img2, mask2, corr, corr.size(), corr.type(), Point(0,0), 0, 0 );
crossCorr( img, mask_templ, result, result.size(), result.type(), Point(0,0), 0, 0 );
crossCorr( img2, mask2, corr, Point(0,0), 0, 0 );
crossCorr( img, mask_templ, result, Point(0,0), 0, 0 );
sqrt(corr, corr);
result = result.mul(1/corr);
@@ -1125,7 +1122,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
CV_IPP_RUN_FAST(ipp_matchTemplate(img, templ, result, method))
crossCorr( img, templ, result, result.size(), result.type(), Point(0,0), 0, 0);
crossCorr( img, templ, result, Point(0,0), 0, 0);
common_matchTemplate(img, templ, result, method, cn);
}