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
ec5bdc7d
Commit
ec5bdc7d
authored
Mar 05, 2012
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added patch error calculation to gpu::PyrLKOpticalFlow
parent
27ecc999
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
10 deletions
+14
-10
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+2
-0
pyrlk.cu
modules/gpu/src/cuda/pyrlk.cu
+0
-0
pyrlk.cpp
modules/gpu/src/pyrlk.cpp
+4
-4
test_video.cpp
modules/gpu/test/test_video.cpp
+2
-2
tests.cpp
samples/gpu/performance/tests.cpp
+6
-4
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
ec5bdc7d
...
...
@@ -1817,6 +1817,7 @@ public:
derivLambda
=
0.5
;
useInitialFlow
=
false
;
minEigThreshold
=
1e-4
f
;
getMinEigenVals
=
false
;
}
void
sparse
(
const
GpuMat
&
prevImg
,
const
GpuMat
&
nextImg
,
const
GpuMat
&
prevPts
,
GpuMat
&
nextPts
,
...
...
@@ -1830,6 +1831,7 @@ public:
double
derivLambda
;
bool
useInitialFlow
;
float
minEigThreshold
;
bool
getMinEigenVals
;
void
releaseMemory
()
{
...
...
modules/gpu/src/cuda/pyrlk.cu
View file @
ec5bdc7d
This diff is collapsed.
Click to expand it.
modules/gpu/src/pyrlk.cpp
View file @
ec5bdc7d
...
...
@@ -63,11 +63,11 @@ namespace cv { namespace gpu { namespace device
cudaStream_t
stream
=
0
);
void
lkSparse_gpu
(
DevMem2Db
I
,
DevMem2Db
J
,
DevMem2D_
<
short
>
dIdx
,
DevMem2D_
<
short
>
dIdy
,
const
float2
*
prevPts
,
float2
*
nextPts
,
uchar
*
status
,
float
*
err
,
int
ptcount
,
const
float2
*
prevPts
,
float2
*
nextPts
,
uchar
*
status
,
float
*
err
,
bool
GET_MIN_EIGENVALS
,
int
ptcount
,
int
level
,
dim3
block
,
dim3
patch
,
cudaStream_t
stream
=
0
);
void
lkDense_gpu
(
DevMem2Db
I
,
DevMem2Db
J
,
DevMem2D_
<
short
>
dIdx
,
DevMem2D_
<
short
>
dIdy
,
DevMem2Df
u
,
DevMem2Df
v
,
DevMem2Df
*
err
,
cudaStream_t
stream
=
0
);
DevMem2Df
u
,
DevMem2Df
v
,
DevMem2Df
*
err
,
bool
GET_MIN_EIGENVALS
,
cudaStream_t
stream
=
0
);
}
}}}
...
...
@@ -205,7 +205,7 @@ void cv::gpu::PyrLKOpticalFlow::sparse(const GpuMat& prevImg, const GpuMat& next
calcSharrDeriv
(
prevPyr_
[
level
],
dIdx
,
dIdy
);
lkSparse_gpu
(
prevPyr_
[
level
],
nextPyr_
[
level
],
dIdx
,
dIdy
,
prevPts
.
ptr
<
float2
>
(),
nextPts
.
ptr
<
float2
>
(),
status
.
ptr
(),
level
==
0
&&
err
?
err
->
ptr
<
float
>
()
:
0
,
prevPts
.
cols
,
prevPts
.
ptr
<
float2
>
(),
nextPts
.
ptr
<
float2
>
(),
status
.
ptr
(),
level
==
0
&&
err
?
err
->
ptr
<
float
>
()
:
0
,
getMinEigenVals
,
prevPts
.
cols
,
level
,
block
,
patch
);
}
}
...
...
@@ -272,7 +272,7 @@ void cv::gpu::PyrLKOpticalFlow::dense(const GpuMat& prevImg, const GpuMat& nextI
calcSharrDeriv
(
prevPyr_
[
level
],
dIdx
,
dIdy
);
lkDense_gpu
(
prevPyr_
[
level
],
nextPyr_
[
level
],
dIdx
,
dIdy
,
uPyr_
[
level
],
vPyr_
[
level
],
level
==
0
&&
err
?
&
derr
:
0
);
level
==
0
&&
err
?
&
derr
:
0
,
getMinEigenVals
);
if
(
level
==
0
)
{
...
...
modules/gpu/test/test_video.cpp
View file @
ec5bdc7d
...
...
@@ -358,7 +358,7 @@ PARAM_TEST_CASE(PyrLKOpticalFlowSparse, cv::gpu::DeviceInfo, bool)
cv
::
goodFeaturesToTrack
(
gray_frame
,
pts
,
1000
,
0.01
,
0.0
);
cv
::
calcOpticalFlowPyrLK
(
frame0
,
frame1
,
pts
,
nextPts_gold
,
status_gold
,
err_gold
,
cv
::
Size
(
21
,
21
),
3
,
cv
::
TermCriteria
(
cv
::
TermCriteria
::
COUNT
+
cv
::
TermCriteria
::
EPS
,
30
,
0.01
),
0.5
,
CV_LKFLOW_GET_MIN_EIGENVALS
);
cv
::
TermCriteria
(
cv
::
TermCriteria
::
COUNT
+
cv
::
TermCriteria
::
EPS
,
30
,
0.01
),
0.5
);
}
};
...
...
@@ -410,7 +410,7 @@ TEST_P(PyrLKOpticalFlowSparse, Accuracy)
bool
eq
=
std
::
abs
(
a
.
x
-
b
.
x
)
<
1
&&
std
::
abs
(
a
.
y
-
b
.
y
)
<
1
;
float
errdiff
=
std
::
abs
(
err
[
i
]
-
err_gold
[
i
]);
if
(
!
eq
||
errdiff
>
1e-
4
)
if
(
!
eq
||
errdiff
>
1e-
1
)
++
mistmatch
;
}
}
...
...
samples/gpu/performance/tests.cpp
View file @
ec5bdc7d
...
...
@@ -1157,10 +1157,12 @@ TEST(PyrLKOpticalFlow)
vector
<
Point2f
>
nextPts
;
vector
<
unsigned
char
>
status
;
calcOpticalFlowPyrLK
(
frame0
,
frame1
,
pts
,
nextPts
,
status
,
noArray
());
vector
<
float
>
err
;
calcOpticalFlowPyrLK
(
frame0
,
frame1
,
pts
,
nextPts
,
status
,
err
);
CPU_ON
;
calcOpticalFlowPyrLK
(
frame0
,
frame1
,
pts
,
nextPts
,
status
,
noArray
()
);
calcOpticalFlowPyrLK
(
frame0
,
frame1
,
pts
,
nextPts
,
status
,
err
);
CPU_OFF
;
gpu
::
PyrLKOpticalFlow
d_pyrLK
;
...
...
@@ -1176,10 +1178,10 @@ TEST(PyrLKOpticalFlow)
gpu
::
GpuMat
d_status
;
gpu
::
GpuMat
d_err
;
d_pyrLK
.
sparse
(
d_frame0
,
d_frame1
,
d_pts
,
d_nextPts
,
d_status
);
d_pyrLK
.
sparse
(
d_frame0
,
d_frame1
,
d_pts
,
d_nextPts
,
d_status
,
&
d_err
);
GPU_ON
;
d_pyrLK
.
sparse
(
d_frame0
,
d_frame1
,
d_pts
,
d_nextPts
,
d_status
);
d_pyrLK
.
sparse
(
d_frame0
,
d_frame1
,
d_pts
,
d_nextPts
,
d_status
,
&
d_err
);
GPU_OFF
;
}
}
...
...
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