Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
de378a72
Commit
de378a72
authored
Jul 15, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #729 from vbystricky:dis_flow
parents
986a2837
5a1fd4c8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
3 deletions
+36
-3
optflow.hpp
modules/optflow/include/opencv2/optflow.hpp
+19
-0
dis_flow.cpp
modules/optflow/src/dis_flow.cpp
+17
-3
No files found.
modules/optflow/include/opencv2/optflow.hpp
View file @
de378a72
...
@@ -302,6 +302,25 @@ public:
...
@@ -302,6 +302,25 @@ public:
/** @copybrief getGradientDescentIterations @see getGradientDescentIterations */
/** @copybrief getGradientDescentIterations @see getGradientDescentIterations */
CV_WRAP
virtual
void
setVariationalRefinementIterations
(
int
val
)
=
0
;
CV_WRAP
virtual
void
setVariationalRefinementIterations
(
int
val
)
=
0
;
/** @brief Weight of the smoothness term
@see setVariationalRefinementAlpha */
CV_WRAP
virtual
float
getVariationalRefinementAlpha
()
const
=
0
;
/** @copybrief getVariationalRefinementAlpha @see getVariationalRefinementAlpha */
CV_WRAP
virtual
void
setVariationalRefinementAlpha
(
float
val
)
=
0
;
/** @brief Weight of the color constancy term
@see setVariationalRefinementDelta */
CV_WRAP
virtual
float
getVariationalRefinementDelta
()
const
=
0
;
/** @copybrief getVariationalRefinementDelta @see getVariationalRefinementDelta */
CV_WRAP
virtual
void
setVariationalRefinementDelta
(
float
val
)
=
0
;
/** @brief Weight of the gradient constancy term
@see setVariationalRefinementGamma */
CV_WRAP
virtual
float
getVariationalRefinementGamma
()
const
=
0
;
/** @copybrief getVariationalRefinementGamma @see getVariationalRefinementGamma */
CV_WRAP
virtual
void
setVariationalRefinementGamma
(
float
val
)
=
0
;
/** @brief Whether to use mean-normalization of patches when computing patch distance. It is turned on
/** @brief Whether to use mean-normalization of patches when computing patch distance. It is turned on
by default as it typically provides a noticeable quality boost because of increased robustness to
by default as it typically provides a noticeable quality boost because of increased robustness to
illumanition variations. Turn it off if you are certain that your sequence does't contain any changes
illumanition variations. Turn it off if you are certain that your sequence does't contain any changes
...
...
modules/optflow/src/dis_flow.cpp
View file @
de378a72
...
@@ -65,6 +65,9 @@ class DISOpticalFlowImpl : public DISOpticalFlow
...
@@ -65,6 +65,9 @@ class DISOpticalFlowImpl : public DISOpticalFlow
int
patch_stride
;
int
patch_stride
;
int
grad_descent_iter
;
int
grad_descent_iter
;
int
variational_refinement_iter
;
int
variational_refinement_iter
;
float
variational_refinement_alpha
;
float
variational_refinement_gamma
;
float
variational_refinement_delta
;
bool
use_mean_normalization
;
bool
use_mean_normalization
;
bool
use_spatial_propagation
;
bool
use_spatial_propagation
;
...
@@ -84,6 +87,13 @@ class DISOpticalFlowImpl : public DISOpticalFlow
...
@@ -84,6 +87,13 @@ class DISOpticalFlowImpl : public DISOpticalFlow
void
setGradientDescentIterations
(
int
val
)
{
grad_descent_iter
=
val
;
}
void
setGradientDescentIterations
(
int
val
)
{
grad_descent_iter
=
val
;
}
int
getVariationalRefinementIterations
()
const
{
return
variational_refinement_iter
;
}
int
getVariationalRefinementIterations
()
const
{
return
variational_refinement_iter
;
}
void
setVariationalRefinementIterations
(
int
val
)
{
variational_refinement_iter
=
val
;
}
void
setVariationalRefinementIterations
(
int
val
)
{
variational_refinement_iter
=
val
;
}
float
getVariationalRefinementAlpha
()
const
{
return
variational_refinement_alpha
;
}
void
setVariationalRefinementAlpha
(
float
val
)
{
variational_refinement_alpha
=
val
;
}
float
getVariationalRefinementDelta
()
const
{
return
variational_refinement_delta
;
}
void
setVariationalRefinementDelta
(
float
val
)
{
variational_refinement_delta
=
val
;
}
float
getVariationalRefinementGamma
()
const
{
return
variational_refinement_gamma
;
}
void
setVariationalRefinementGamma
(
float
val
)
{
variational_refinement_gamma
=
val
;
}
bool
getUseMeanNormalization
()
const
{
return
use_mean_normalization
;
}
bool
getUseMeanNormalization
()
const
{
return
use_mean_normalization
;
}
void
setUseMeanNormalization
(
bool
val
)
{
use_mean_normalization
=
val
;
}
void
setUseMeanNormalization
(
bool
val
)
{
use_mean_normalization
=
val
;
}
bool
getUseSpatialPropagation
()
const
{
return
use_spatial_propagation
;
}
bool
getUseSpatialPropagation
()
const
{
return
use_spatial_propagation
;
}
...
@@ -161,6 +171,10 @@ DISOpticalFlowImpl::DISOpticalFlowImpl()
...
@@ -161,6 +171,10 @@ DISOpticalFlowImpl::DISOpticalFlowImpl()
patch_stride
=
4
;
patch_stride
=
4
;
grad_descent_iter
=
16
;
grad_descent_iter
=
16
;
variational_refinement_iter
=
5
;
variational_refinement_iter
=
5
;
variational_refinement_alpha
=
20.
f
;
variational_refinement_gamma
=
10.
f
;
variational_refinement_delta
=
5.
f
;
border_size
=
16
;
border_size
=
16
;
use_mean_normalization
=
true
;
use_mean_normalization
=
true
;
use_spatial_propagation
=
true
;
use_spatial_propagation
=
true
;
...
@@ -234,9 +248,9 @@ void DISOpticalFlowImpl::prepareBuffers(Mat &I0, Mat &I1)
...
@@ -234,9 +248,9 @@ void DISOpticalFlowImpl::prepareBuffers(Mat &I0, Mat &I1)
spatialGradient
(
I0s
[
i
],
I0xs
[
i
],
I0ys
[
i
]);
spatialGradient
(
I0s
[
i
],
I0xs
[
i
],
I0ys
[
i
]);
Ux
[
i
].
create
(
cur_rows
,
cur_cols
);
Ux
[
i
].
create
(
cur_rows
,
cur_cols
);
Uy
[
i
].
create
(
cur_rows
,
cur_cols
);
Uy
[
i
].
create
(
cur_rows
,
cur_cols
);
variational_refinement_processors
[
i
]
->
setAlpha
(
20.0
f
);
variational_refinement_processors
[
i
]
->
setAlpha
(
variational_refinement_alpha
);
variational_refinement_processors
[
i
]
->
setDelta
(
5.0
f
);
variational_refinement_processors
[
i
]
->
setDelta
(
variational_refinement_delta
);
variational_refinement_processors
[
i
]
->
setGamma
(
10.0
f
);
variational_refinement_processors
[
i
]
->
setGamma
(
variational_refinement_gamma
);
variational_refinement_processors
[
i
]
->
setSorIterations
(
5
);
variational_refinement_processors
[
i
]
->
setSorIterations
(
5
);
variational_refinement_processors
[
i
]
->
setFixedPointIterations
(
variational_refinement_iter
);
variational_refinement_processors
[
i
]
->
setFixedPointIterations
(
variational_refinement_iter
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment