Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
07744af7
Commit
07744af7
authored
Aug 11, 2014
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3066 from vpisarev:minor_fixes
parents
0f66e275
68305703
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
ecc.cpp
modules/video/src/ecc.cpp
+6
-1
optflowgf.cpp
modules/video/src/optflowgf.cpp
+10
-6
fback.cpp
samples/cpp/fback.cpp
+5
-3
No files found.
modules/video/src/ecc.cpp
View file @
07744af7
...
...
@@ -297,7 +297,12 @@ static void update_warping_matrix_ECC (Mat& map_matrix, const Mat& update, const
mapPtr
[
5
]
+=
updatePtr
[
7
];
}
if
(
motionType
==
MOTION_EUCLIDEAN
)
{
double
new_theta
=
acos
(
mapPtr
[
0
])
+
updatePtr
[
0
];
double
new_theta
=
updatePtr
[
0
];
if
(
mapPtr
[
3
]
>
0
)
new_theta
+=
acos
(
mapPtr
[
0
]);
if
(
mapPtr
[
3
]
<
0
)
new_theta
-=
acos
(
mapPtr
[
0
]);
mapPtr
[
2
]
+=
updatePtr
[
1
];
mapPtr
[
5
]
+=
updatePtr
[
2
];
...
...
modules/video/src/optflowgf.cpp
View file @
07744af7
...
...
@@ -43,6 +43,10 @@
#include "precomp.hpp"
#include "opencl_kernels_video.hpp"
#if defined __APPLE__ || defined ANDROID
#define SMALL_LOCALSIZE
#endif
//
// 2D dense optical flow algorithm from the following paper:
// Gunnar Farneback. "Two-Frame Motion Estimation Based on Polynomial Expansion".
...
...
@@ -836,7 +840,7 @@ private:
bool
gaussianBlurOcl
(
const
UMat
&
src
,
int
ksizeHalf
,
UMat
&
dst
)
{
#ifdef
ANDROID
#ifdef
SMALL_LOCALSIZE
size_t
localsize
[
2
]
=
{
128
,
1
};
#else
size_t
localsize
[
2
]
=
{
256
,
1
};
...
...
@@ -863,7 +867,7 @@ private:
bool
gaussianBlur5Ocl
(
const
UMat
&
src
,
int
ksizeHalf
,
UMat
&
dst
)
{
int
height
=
src
.
rows
/
5
;
#ifdef
ANDROID
#ifdef
SMALL_LOCALSIZE
size_t
localsize
[
2
]
=
{
128
,
1
};
#else
size_t
localsize
[
2
]
=
{
256
,
1
};
...
...
@@ -888,7 +892,7 @@ private:
}
bool
polynomialExpansionOcl
(
const
UMat
&
src
,
UMat
&
dst
)
{
#ifdef
ANDROID
#ifdef
SMALL_LOCALSIZE
size_t
localsize
[
2
]
=
{
128
,
1
};
#else
size_t
localsize
[
2
]
=
{
256
,
1
};
...
...
@@ -925,7 +929,7 @@ private:
bool
boxFilter5Ocl
(
const
UMat
&
src
,
int
ksizeHalf
,
UMat
&
dst
)
{
int
height
=
src
.
rows
/
5
;
#ifdef
ANDROID
#ifdef
SMALL_LOCALSIZE
size_t
localsize
[
2
]
=
{
128
,
1
};
#else
size_t
localsize
[
2
]
=
{
256
,
1
};
...
...
@@ -952,7 +956,7 @@ private:
bool
updateFlowOcl
(
const
UMat
&
M
,
UMat
&
flowx
,
UMat
&
flowy
)
{
#ifdef
ANDROID
#ifdef
SMALL_LOCALSIZE
size_t
localsize
[
2
]
=
{
32
,
4
};
#else
size_t
localsize
[
2
]
=
{
32
,
8
};
...
...
@@ -976,7 +980,7 @@ private:
}
bool
updateMatricesOcl
(
const
UMat
&
flowx
,
const
UMat
&
flowy
,
const
UMat
&
R0
,
const
UMat
&
R1
,
UMat
&
M
)
{
#ifdef
ANDROID
#ifdef
SMALL_LOCALSIZE
size_t
localsize
[
2
]
=
{
32
,
4
};
#else
size_t
localsize
[
2
]
=
{
32
,
8
};
...
...
samples/cpp/fback.cpp
View file @
07744af7
...
...
@@ -37,7 +37,8 @@ int main(int, char**)
if
(
!
cap
.
isOpened
()
)
return
-
1
;
Mat
prevgray
,
gray
,
flow
,
cflow
,
frame
;
Mat
flow
,
cflow
,
frame
;
UMat
gray
,
prevgray
,
uflow
;
namedWindow
(
"flow"
,
1
);
for
(;;)
...
...
@@ -45,10 +46,11 @@ int main(int, char**)
cap
>>
frame
;
cvtColor
(
frame
,
gray
,
COLOR_BGR2GRAY
);
if
(
prevgray
.
data
)
if
(
!
prevgray
.
empty
()
)
{
calcOpticalFlowFarneback
(
prevgray
,
gray
,
flow
,
0.5
,
3
,
15
,
3
,
5
,
1.2
,
0
);
calcOpticalFlowFarneback
(
prevgray
,
gray
,
u
flow
,
0.5
,
3
,
15
,
3
,
5
,
1.2
,
0
);
cvtColor
(
prevgray
,
cflow
,
COLOR_GRAY2BGR
);
uflow
.
copyTo
(
flow
);
drawOptFlowMap
(
flow
,
cflow
,
16
,
1.5
,
Scalar
(
0
,
255
,
0
));
imshow
(
"flow"
,
cflow
);
}
...
...
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