Commit a877ecdc authored by Andrey Kamaev's avatar Andrey Kamaev

Added option to pass pre-computed pyramid to piramidal LK optical flow #1321

parent f620f1ce
...@@ -203,9 +203,6 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom, ...@@ -203,9 +203,6 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
Mat src = _src.getMat(); Mat src = _src.getMat();
CV_Assert( top >= 0 && bottom >= 0 && left >= 0 && right >= 0 ); CV_Assert( top >= 0 && bottom >= 0 && left >= 0 && right >= 0 );
_dst.create( src.rows + top + bottom, src.cols + left + right, src.type() );
Mat dst = _dst.getMat();
if( src.isSubmatrix() && (borderType & BORDER_ISOLATED) == 0 ) if( src.isSubmatrix() && (borderType & BORDER_ISOLATED) == 0 )
{ {
Size wholeSize; Size wholeSize;
...@@ -221,6 +218,16 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom, ...@@ -221,6 +218,16 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
bottom -= dbottom; bottom -= dbottom;
right -= dright; right -= dright;
} }
_dst.create( src.rows + top + bottom, src.cols + left + right, src.type() );
Mat dst = _dst.getMat();
if(top == 0 && left == 0 && bottom == 0 && right == 0)
{
if(src.data != dst.data)
src.copyTo(dst);
return;
}
borderType &= ~BORDER_ISOLATED; borderType &= ~BORDER_ISOLATED;
......
...@@ -33,7 +33,7 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize, OpticalFlowPyrLK, testing::Combine( ...@@ -33,7 +33,7 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize, OpticalFlowPyrLK, testing::Combine(
testing::Range(0, 3), testing::Range(0, 3),
testing::Values(1, 3, 4), testing::Values(1, 3, 4),
testing::Values(make_tuple(9, 9), make_tuple(15, 15)), testing::Values(make_tuple(9, 9), make_tuple(15, 15)),
testing::Values(11, 21, 25) testing::Values(7, 11, 21, 25)
) )
) )
{ {
...@@ -49,7 +49,7 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize, OpticalFlowPyrLK, testing::Combine( ...@@ -49,7 +49,7 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize, OpticalFlowPyrLK, testing::Combine(
int nPointsY = min(get<1>(get<3>(GetParam())), img1.rows); int nPointsY = min(get<1>(get<3>(GetParam())), img1.rows);
int winSize = get<4>(GetParam()); int winSize = get<4>(GetParam());
int maxLevel = 2; int maxLevel = 2;
TermCriteria criteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 5, 0.01); TermCriteria criteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 7, 0.001);
int flags = 0; int flags = 0;
double minEigThreshold = 1e-4; double minEigThreshold = 1e-4;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment