Skip to content

Add robust local optical flow (RLOF) implementations #1940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Dec 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
04830a7
Add robust local optical flow (RLOF) implementations which is an impr…
Dec 9, 2018
69ef784
- exchange tabs with spaces
Dec 10, 2018
9b11b49
introducing precompiler flag RLOD_SSE
Dec 11, 2018
2b41b05
remove header that could not be found
Dec 11, 2018
4956de9
remove whitespaces
Dec 11, 2018
a6cc9bb
remove x86intrin.h header
Dec 11, 2018
c367b8c
fix ios and arm by removing last sse commands
Dec 11, 2018
085e3c0
fix warnings for windows compilation
Dec 11, 2018
3f759af
fix documentation RLOFOpticalFlowParameter
Dec 11, 2018
fb31337
integrate cast to remove last warnings
Dec 11, 2018
d1440c0
* add create method and function inferfaces to RLOFOpticalFlowParamte…
Dec 12, 2018
912c1dd
white space fixes / coding style
alalek Dec 14, 2018
2b4eb0b
fix perf test
alalek Dec 14, 2018
8ccab0b
other changes: precomp.hpp / static
alalek Dec 14, 2018
70f1116
use Matx44f and Vec4f instead of Mat
alalek Dec 14, 2018
3b794f2
normSigmas into constants
alalek Dec 14, 2018
5acff7b
replace ceil() calls
alalek Dec 14, 2018
aa3cc4c
maximum level is set to 5 so that it is similar value used in the papers
Dec 14, 2018
725e296
implement paralellized horizontal cross segmentation as used in Geist…
Dec 14, 2018
c1c94a2
drop dead code
Dec 14, 2018
b95339c
Avoid using "data" and "step" calculations. Use .ptr<mat_type>(row, c…
Dec 15, 2018
873e03a
Avoid using "data" and "step" calculations. Use .ptr<mat_type>(row, c…
Dec 15, 2018
0046f54
bugfix on BEPLK with ica and adapt the accuracy tests
Dec 16, 2018
221b861
more 'static' functions
alalek Dec 16, 2018
dcdc9c9
bugfix after changing ptr + step to .ptr(y,x) calls by adjusting ROI of
Dec 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/optflow/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set(the_description "Optical Flow Algorithms")
ocv_define_module(optflow opencv_core opencv_imgproc opencv_video opencv_ximgproc opencv_imgcodecs opencv_flann WRAP python)
ocv_define_module(optflow opencv_core opencv_imgproc opencv_calib3d opencv_video opencv_ximgproc opencv_imgcodecs opencv_flann WRAP python)
49 changes: 49 additions & 0 deletions modules/optflow/doc/optflow.bib
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,52 @@ @inproceedings{Wang_2016_CVPR
month = {June},
year = {2016}
}

@inproceedings{Geistert2016,
author = {Jonas Geistert and Tobias Senst and Thomas Sikora},
title = {Robust Local Optical Flow: Dense Motion Vector Field Interpolation},
booktitle = {Picture Coding Symposium},
year = {2016},
pages = {1--5},
}

@inproceedings{Senst2016,
author = {Tobias Senst and Jonas Geistert and Thomas Sikora},
title = {Robust local optical flow: Long-range motions and varying illuminations},
booktitle = {IEEE International Conference on Image Processing},
year = {2016},
pages = {4478--4482},
}

@inproceedings{Senst2014,
author = {Tobias Senst and Thilo Borgmann and Ivo Keller and Thomas Sikora},
title = {Cross based Robust Local Optical Flow},
booktitle = {21th IEEE International Conference on Image Processing},
year = {2014},
pages = {1967--1971},
}

@inproceedings{Senst2013,
author = {Tobias Senst and Jonas Geistert and Ivo Keller and Thomas Sikora},
title = {Robust Local Optical Flow Estimation using Bilinear Equations for Sparse Motion Estimation},
booktitle = {20th IEEE International Conference on Image Processing},
year = {2013},
pages = {2499--2503},
}

@article{Senst2012,
author = {Tobias Senst and Volker Eiselein and Thomas Sikora},
title = {Robust Local Optical Flow for Feature Tracking},
journal = {IEEE Transactions on Circuits and Systems for Video Technology},
year = {2012},
pages = {1377--1387},
volume = {22},
number = {9},
}

@article{Tibshirani2008,
title={Fast computation of the median by successive binning},
author={Tibshirani, Ryan J},
journal={arXiv preprint arXiv:0806.3301},
year={2008}
}
2 changes: 1 addition & 1 deletion modules/optflow/include/opencv2/optflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Functions reading and writing .flo files in "Middlebury" format, see: <http://vi

#include "opencv2/optflow/pcaflow.hpp"
#include "opencv2/optflow/sparse_matching_gpc.hpp"

#include "opencv2/optflow/rlofflow.hpp"
namespace cv
{
namespace optflow
Expand Down
493 changes: 493 additions & 0 deletions modules/optflow/include/opencv2/optflow/rlofflow.hpp

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions modules/optflow/perf/perf_rlof.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#include "perf_precomp.hpp"
namespace opencv_test { namespace {

typedef tuple<std::string, std::string, bool> ST_SR_IM_Sparse_t;
typedef TestBaseWithParam<ST_SR_IM_Sparse_t> ST_SR_IM_Sparse;
PERF_TEST_P(ST_SR_IM_Sparse, OpticalFlow_SparseRLOF,
testing::Combine(
testing::Values<std::string>("ST_BILINEAR", "ST_STANDART"),
testing::Values<std::string>("SR_CROSS", "SR_FIXED"),
testing::Values(true, false))
)
{
Mat frame1 = imread(getDataPath("cv/optflow/RubberWhale1.png"));
Mat frame2 = imread(getDataPath("cv/optflow/RubberWhale2.png"));
ASSERT_FALSE(frame1.empty());
ASSERT_FALSE(frame2.empty());
vector<Point2f> prevPts, currPts;
for (int r = 0; r < frame1.rows; r += 10)
{
for (int c = 0; c < frame1.cols; c += 10)
{
prevPts.push_back(Point2f(static_cast<float>(c), static_cast<float>(r)));
}
}
vector<uchar> status(prevPts.size());
vector<float> err(prevPts.size());

Ptr<RLOFOpticalFlowParameter> param = Ptr<RLOFOpticalFlowParameter>(new RLOFOpticalFlowParameter);
if (get<0>(GetParam()) == "ST_BILINEAR")
param->solverType = ST_BILINEAR;
if (get<0>(GetParam()) == "ST_STANDART")
param->solverType = ST_STANDART;
if (get<1>(GetParam()) == "SR_CROSS")
param->supportRegionType = SR_CROSS;
if (get<1>(GetParam()) == "SR_FIXED")
param->supportRegionType = SR_FIXED;
param->useIlluminationModel = get<2>(GetParam());

PERF_SAMPLE_BEGIN()
calcOpticalFlowSparseRLOF(frame1, frame2, prevPts, currPts, status, err, param, 1.f);
PERF_SAMPLE_END()

SANITY_CHECK_NOTHING();
}

typedef tuple<std::string, int> INTERP_GRID_Dense_t;
typedef TestBaseWithParam<INTERP_GRID_Dense_t> INTERP_GRID_Dense;
PERF_TEST_P(INTERP_GRID_Dense, OpticalFlow_DenseRLOF,
testing::Combine(
testing::Values<std::string>("INTERP_EPIC", "INTERP_GEO"),
testing::Values<int>(4,10))
)
{
Mat flow;
Mat frame1 = imread(getDataPath("cv/optflow/RubberWhale1.png"));
Mat frame2 = imread(getDataPath("cv/optflow/RubberWhale1.png"));
ASSERT_FALSE(frame1.empty());
ASSERT_FALSE(frame2.empty());
Ptr<RLOFOpticalFlowParameter> param = Ptr<RLOFOpticalFlowParameter>(new RLOFOpticalFlowParameter);;
Ptr< DenseRLOFOpticalFlow> algo = DenseRLOFOpticalFlow::create();
InterpolationType interp_type = INTERP_EPIC;
if (get<0>(GetParam()) == "INTERP_EPIC")
interp_type = INTERP_EPIC;
if (get<0>(GetParam()) == "INTERP_GEO")
interp_type = INTERP_GEO;
PERF_SAMPLE_BEGIN()
calcOpticalFlowDenseRLOF(frame1, frame2,flow, param, 1.0f, Size(get<1>(GetParam()), get<1>(GetParam())), interp_type);
PERF_SAMPLE_END()
SANITY_CHECK_NOTHING();
}

}} // namespace
Loading