Merge pull request #17180 from PetWorm:3.4

* fix Scharr nomination
pull/17188/head
QIU Xiaochen 5 years ago committed by GitHub
parent 6630eac813
commit cdfa58dde0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      modules/cudaoptflow/src/cuda/pyrlk.cu
  2. 10
      modules/video/src/lkpyramid.cpp
  3. 4
      modules/video/src/lkpyramid.hpp

@ -415,7 +415,7 @@ namespace pyrlk
I_patch[i][j] = Tex_I<cn, T>::read(x, y);
// Sharr Deriv
// Scharr Deriv
work_type dIdx = 3.0f * Tex_I<cn,T>::read(x+1, y-1) + 10.0f * Tex_I<cn, T>::read(x+1, y) + 3.0f * Tex_I<cn,T>::read(x+1, y+1) -
(3.0f * Tex_I<cn,T>::read(x-1, y-1) + 10.0f * Tex_I<cn, T>::read(x-1, y) + 3.0f * Tex_I<cn,T>::read(x-1, y+1));
@ -608,7 +608,7 @@ namespace pyrlk
I_patch[i][j] = ToFloat<T>(I(y, x));
// Sharr Deriv
// Scharr Deriv
work_type dIdx = 3.0f * I(y - 1, x + 1) + 10.0f * I(y, x + 1) + 3.0f * I(y + 1, x + 1) -
(3.0f * I(y - 1, x - 1) + 10.0f * I(y, x - 1) + 3.0f * I(y + 1 , x - 1));
@ -927,7 +927,7 @@ namespace pyrlk
I_patch[i * patchWidth + j] = tex2D(tex_If, x, y);
// Sharr Deriv
// Scharr Deriv
dIdx_patch[i * patchWidth + j] = 3 * tex2D(tex_If, x+1, y-1) + 10 * tex2D(tex_If, x+1, y) + 3 * tex2D(tex_If, x+1, y+1) -
(3 * tex2D(tex_If, x-1, y-1) + 10 * tex2D(tex_If, x-1, y) + 3 * tex2D(tex_If, x-1, y+1));

@ -52,19 +52,19 @@
namespace
{
static void calcSharrDeriv(const cv::Mat& src, cv::Mat& dst)
static void calcScharrDeriv(const cv::Mat& src, cv::Mat& dst)
{
using namespace cv;
using cv::detail::deriv_type;
int rows = src.rows, cols = src.cols, cn = src.channels(), depth = src.depth();
CV_Assert(depth == CV_8U);
dst.create(rows, cols, CV_MAKETYPE(DataType<deriv_type>::depth, cn*2));
parallel_for_(Range(0, rows), cv::detail::SharrDerivInvoker(src, dst), cv::getNumThreads());
parallel_for_(Range(0, rows), cv::detail::ScharrDerivInvoker(src, dst), cv::getNumThreads());
}
}//namespace
void cv::detail::SharrDerivInvoker::operator()(const Range& range) const
void cv::detail::ScharrDerivInvoker::operator()(const Range& range) const
{
using cv::detail::deriv_type;
int rows = src.rows, cols = src.cols, cn = src.channels(), colsn = cols*cn;
@ -803,7 +803,7 @@ int cv::buildOpticalFlowPyramid(InputArray _img, OutputArrayOfArrays pyramid, Si
deriv.create(sz.height + winSize.height*2, sz.width + winSize.width*2, derivType);
Mat derivI = deriv(Rect(winSize.width, winSize.height, sz.width, sz.height));
calcSharrDeriv(thisLevel, derivI);
calcScharrDeriv(thisLevel, derivI);
if(derivBorder != BORDER_TRANSPARENT)
copyMakeBorder(derivI, deriv, winSize.height, winSize.height, winSize.width, winSize.width, derivBorder|BORDER_ISOLATED);
@ -1384,7 +1384,7 @@ void SparsePyrLKOpticalFlowImpl::calc( InputArray _prevImg, InputArray _nextImg,
Mat _derivI( imgSize.height + winSize.height*2,
imgSize.width + winSize.width*2, derivIBuf.type(), derivIBuf.ptr() );
derivI = _derivI(Rect(winSize.width, winSize.height, imgSize.width, imgSize.height));
calcSharrDeriv(prevPyr[level * lvlStep1], derivI);
calcScharrDeriv(prevPyr[level * lvlStep1], derivI);
copyMakeBorder(derivI, _derivI, winSize.height, winSize.height, winSize.width, winSize.width, BORDER_CONSTANT|BORDER_ISOLATED);
}
else

@ -7,9 +7,9 @@ namespace detail
typedef short deriv_type;
struct SharrDerivInvoker : ParallelLoopBody
struct ScharrDerivInvoker : ParallelLoopBody
{
SharrDerivInvoker(const Mat& _src, const Mat& _dst)
ScharrDerivInvoker(const Mat& _src, const Mat& _dst)
: src(_src), dst(_dst)
{ }

Loading…
Cancel
Save