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
87bb7ff5
Commit
87bb7ff5
authored
Mar 31, 2013
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Mar 31, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #721 from jet47:tvl1-bug-fix
parents
6bf0181d
924b0ef7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
24 deletions
+27
-24
tvl1flow.cpp
modules/gpu/src/tvl1flow.cpp
+12
-10
tvl1flow.cpp
modules/video/src/tvl1flow.cpp
+15
-14
No files found.
modules/gpu/src/tvl1flow.cpp
View file @
87bb7ff5
...
...
@@ -130,6 +130,17 @@ void cv::gpu::OpticalFlowDual_TVL1_GPU::operator ()(const GpuMat& I0, const GpuM
gpu
::
multiply
(
u1s
[
s
],
Scalar
::
all
(
0.5
),
u1s
[
s
]);
gpu
::
multiply
(
u2s
[
s
],
Scalar
::
all
(
0.5
),
u2s
[
s
]);
}
else
{
u1s
[
s
].
create
(
I0s
[
s
].
size
(),
CV_32FC1
);
u2s
[
s
].
create
(
I0s
[
s
].
size
(),
CV_32FC1
);
}
}
if
(
!
useInitialFlow
)
{
u1s
[
nscales
-
1
].
setTo
(
Scalar
::
all
(
0
));
u2s
[
nscales
-
1
].
setTo
(
Scalar
::
all
(
0
));
}
// pyramidal structure for computing the optical flow
...
...
@@ -174,18 +185,9 @@ void cv::gpu::OpticalFlowDual_TVL1_GPU::procOneScale(const GpuMat& I0, const Gpu
CV_DbgAssert
(
I1
.
size
()
==
I0
.
size
()
);
CV_DbgAssert
(
I1
.
type
()
==
I0
.
type
()
);
CV_DbgAssert
(
u1
.
empty
()
||
u1
.
size
()
==
I0
.
size
()
);
CV_DbgAssert
(
u1
.
size
()
==
I0
.
size
()
);
CV_DbgAssert
(
u2
.
size
()
==
u1
.
size
()
);
if
(
u1
.
empty
())
{
u1
.
create
(
I0
.
size
(),
CV_32FC1
);
u1
.
setTo
(
Scalar
::
all
(
0
));
u2
.
create
(
I0
.
size
(),
CV_32FC1
);
u2
.
setTo
(
Scalar
::
all
(
0
));
}
GpuMat
I1x
=
I1x_buf
(
Rect
(
0
,
0
,
I0
.
cols
,
I0
.
rows
));
GpuMat
I1y
=
I1y_buf
(
Rect
(
0
,
0
,
I0
.
cols
,
I0
.
rows
));
centeredGradient
(
I1
,
I1x
,
I1y
);
...
...
modules/video/src/tvl1flow.cpp
View file @
87bb7ff5
...
...
@@ -169,13 +169,12 @@ void OpticalFlowDual_TVL1::calc(InputArray _I0, InputArray _I1, InputOutputArray
I0
.
convertTo
(
I0s
[
0
],
I0s
[
0
].
depth
(),
I0
.
depth
()
==
CV_8U
?
1.0
:
255.0
);
I1
.
convertTo
(
I1s
[
0
],
I1s
[
0
].
depth
(),
I1
.
depth
()
==
CV_8U
?
1.0
:
255.0
);
u1s
[
0
].
create
(
I0
.
size
());
u2s
[
0
].
create
(
I0
.
size
());
if
(
useInitialFlow
)
{
u1s
[
0
].
create
(
I0
.
size
());
u2s
[
0
].
create
(
I0
.
size
());
Mat_
<
float
>
mv
[]
=
{
u1s
[
0
],
u2s
[
0
]};
split
(
_flow
.
getMat
(),
mv
);
}
...
...
@@ -228,6 +227,17 @@ void OpticalFlowDual_TVL1::calc(InputArray _I0, InputArray _I1, InputOutputArray
multiply
(
u1s
[
s
],
Scalar
::
all
(
0.5
),
u1s
[
s
]);
multiply
(
u2s
[
s
],
Scalar
::
all
(
0.5
),
u2s
[
s
]);
}
else
{
u1s
[
s
].
create
(
I0s
[
s
].
size
());
u2s
[
s
].
create
(
I0s
[
s
].
size
());
}
}
if
(
!
useInitialFlow
)
{
u1s
[
nscales
-
1
].
setTo
(
Scalar
::
all
(
0
));
u2s
[
nscales
-
1
].
setTo
(
Scalar
::
all
(
0
));
}
// pyramidal structure for computing the optical flow
...
...
@@ -793,18 +803,9 @@ void OpticalFlowDual_TVL1::procOneScale(const Mat_<float>& I0, const Mat_<float>
CV_DbgAssert
(
I1
.
size
()
==
I0
.
size
()
);
CV_DbgAssert
(
I1
.
type
()
==
I0
.
type
()
);
CV_DbgAssert
(
u1
.
empty
()
||
u1
.
size
()
==
I0
.
size
()
);
CV_DbgAssert
(
u1
.
size
()
==
I0
.
size
()
);
CV_DbgAssert
(
u2
.
size
()
==
u1
.
size
()
);
if
(
u1
.
empty
())
{
u1
.
create
(
I0
.
size
());
u1
.
setTo
(
Scalar
::
all
(
0
));
u2
.
create
(
I0
.
size
());
u2
.
setTo
(
Scalar
::
all
(
0
));
}
Mat_
<
float
>
I1x
=
I1x_buf
(
Rect
(
0
,
0
,
I0
.
cols
,
I0
.
rows
));
Mat_
<
float
>
I1y
=
I1y_buf
(
Rect
(
0
,
0
,
I0
.
cols
,
I0
.
rows
));
centeredGradient
(
I1
,
I1x
,
I1y
);
...
...
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