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
329f49e9
Commit
329f49e9
authored
Jun 13, 2016
by
Vladislav Samsonov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Passing of the prior file to the evaluation tool
parent
f9ef5d45
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
pcaflow.hpp
modules/optflow/include/opencv2/optflow/pcaflow.hpp
+4
-4
optical_flow_evaluation.cpp
modules/optflow/samples/optical_flow_evaluation.cpp
+11
-3
pcaflow.cpp
modules/optflow/src/pcaflow.cpp
+2
-2
No files found.
modules/optflow/include/opencv2/optflow/pcaflow.hpp
View file @
329f49e9
...
...
@@ -66,7 +66,7 @@ namespace optflow
* Solution will be regularized according to this prior.
* You need to generate appropriate prior file with "learn_prior.py" script beforehand.
*/
class
PCAPrior
class
CV_EXPORTS_W
PCAPrior
{
private
:
Mat
L1
;
...
...
@@ -84,10 +84,10 @@ public:
void
fillConstraints
(
float
*
A1
,
float
*
A2
,
float
*
b1
,
float
*
b2
)
const
;
};
class
OpticalFlowPCAFlow
:
public
DenseOpticalFlow
class
CV_EXPORTS_W
OpticalFlowPCAFlow
:
public
DenseOpticalFlow
{
protected
:
const
P
CAPrior
*
prior
;
const
P
tr
<
const
PCAPrior
>
prior
;
const
Size
basisSize
;
const
float
sparseRate
;
// (0 .. 0.1)
const
float
retainedCornersFraction
;
// [0 .. 1]
...
...
@@ -95,7 +95,7 @@ protected:
const
float
dampingFactor
;
public
:
OpticalFlowPCAFlow
(
const
PCAPrior
*
_prior
=
0
,
const
Size
_basisSize
=
Size
(
18
,
14
),
OpticalFlowPCAFlow
(
Ptr
<
const
PCAPrior
>
_prior
=
Ptr
<
const
PCAPrior
>
()
,
const
Size
_basisSize
=
Size
(
18
,
14
),
float
_sparseRate
=
0.02
,
float
_retainedCornersFraction
=
0.7
,
float
_occlusionsThreshold
=
0.0003
,
float
_dampingFactor
=
0.00002
);
...
...
modules/optflow/samples/optical_flow_evaluation.cpp
View file @
329f49e9
...
...
@@ -17,7 +17,8 @@ const String keys = "{help h usage ? | | print this message }"
"{m measure |endpoint| error measure - [endpoint or angular] }"
"{r region |all | region to compute stats about [all, discontinuities, untextured] }"
"{d display | | display additional info images (pauses program execution) }"
"{g gpu | | use OpenCL}"
;
"{g gpu | | use OpenCL}"
"{prior | | path to a prior file for PCAFlow}"
;
inline
bool
isFlowCorrect
(
const
Point2f
u
)
{
...
...
@@ -258,8 +259,15 @@ int main( int argc, char** argv )
algorithm
=
createOptFlow_DeepFlow
();
else
if
(
method
==
"sparsetodenseflow"
)
algorithm
=
createOptFlow_SparseToDense
();
else
if
(
method
==
"pcaflow"
)
algorithm
=
createOptFlow_PCAFlow
();
else
if
(
method
==
"pcaflow"
)
{
if
(
parser
.
has
(
"prior"
)
)
{
String
prior
=
parser
.
get
<
String
>
(
"prior"
);
printf
(
"Using prior file: %s
\n
"
,
prior
.
c_str
());
algorithm
=
makePtr
<
OpticalFlowPCAFlow
>
(
makePtr
<
PCAPrior
>
(
prior
.
c_str
()));
}
else
algorithm
=
createOptFlow_PCAFlow
();
}
else
if
(
method
==
"DISflow"
)
algorithm
=
createOptFlow_DIS
();
else
...
...
modules/optflow/src/pcaflow.cpp
View file @
329f49e9
...
...
@@ -48,7 +48,7 @@ namespace cv
namespace
optflow
{
OpticalFlowPCAFlow
::
OpticalFlowPCAFlow
(
const
PCAPrior
*
_prior
,
const
Size
_basisSize
,
float
_sparseRate
,
OpticalFlowPCAFlow
::
OpticalFlowPCAFlow
(
Ptr
<
const
PCAPrior
>
_prior
,
const
Size
_basisSize
,
float
_sparseRate
,
float
_retainedCornersFraction
,
float
_occlusionsThreshold
,
float
_dampingFactor
)
:
prior
(
_prior
),
basisSize
(
_basisSize
),
sparseRate
(
_sparseRate
),
...
...
@@ -451,7 +451,7 @@ void OpticalFlowPCAFlow::calc( InputArray I0, InputArray I1, InputOutputArray fl
Mat
flow
=
flowOut
.
getMat
();
Mat
w1
,
w2
;
if
(
prior
)
if
(
prior
.
get
()
)
{
Mat
A1
,
A2
,
b1
,
b2
;
getSystem
(
A1
,
A2
,
b1
,
b2
,
features
,
predictedFeatures
,
size
);
...
...
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