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
ff5eaadf
Commit
ff5eaadf
authored
Jan 24, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8045 from onetimking:master
parents
205ccddf
203b398c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
pyrlk.cu
modules/cudaoptflow/src/cuda/pyrlk.cu
+11
-8
pyrlk.cpp
modules/cudaoptflow/src/pyrlk.cpp
+4
-2
No files found.
modules/cudaoptflow/src/cuda/pyrlk.cu
View file @
ff5eaadf
...
...
@@ -51,6 +51,8 @@
#include "opencv2/core/cuda/filters.hpp"
#include "opencv2/core/cuda/border_interpolate.hpp"
#include <iostream>
using namespace cv::cuda;
using namespace cv::cuda::device;
...
...
@@ -923,15 +925,15 @@ namespace pyrlk
float x = xBase - c_halfWin_x + j + 0.5f;
float y = yBase - c_halfWin_y + i + 0.5f;
I_patch[i * patchWidth + j] = tex2D(tex_I
b
, x, y);
I_patch[i * patchWidth + j] = tex2D(tex_I
f
, x, y);
// Sharr Deriv
dIdx_patch[i * patchWidth + j] = 3 * tex2D(tex_I
b, x+1, y-1) + 10 * tex2D(tex_Ib, x+1, y) + 3 * tex2D(tex_Ib
, x+1, y+1) -
(3 * tex2D(tex_I
b, x-1, y-1) + 10 * tex2D(tex_Ib, x-1, y) + 3 * tex2D(tex_Ib
, x-1, y+1));
dIdx_patch[i * patchWidth + j] = 3 * tex2D(tex_I
f, x+1, y-1) + 10 * tex2D(tex_If, x+1, y) + 3 * tex2D(tex_If
, x+1, y+1) -
(3 * tex2D(tex_I
f, x-1, y-1) + 10 * tex2D(tex_If, x-1, y) + 3 * tex2D(tex_If
, x-1, y+1));
dIdy_patch[i * patchWidth + j] = 3 * tex2D(tex_I
b, x-1, y+1) + 10 * tex2D(tex_Ib, x, y+1) + 3 * tex2D(tex_Ib
, x+1, y+1) -
(3 * tex2D(tex_I
b, x-1, y-1) + 10 * tex2D(tex_Ib, x, y-1) + 3 * tex2D(tex_Ib
, x+1, y-1));
dIdy_patch[i * patchWidth + j] = 3 * tex2D(tex_I
f, x-1, y+1) + 10 * tex2D(tex_If, x, y+1) + 3 * tex2D(tex_If
, x+1, y+1) -
(3 * tex2D(tex_I
f, x-1, y-1) + 10 * tex2D(tex_If, x, y-1) + 3 * tex2D(tex_If
, x+1, y-1));
}
}
...
...
@@ -943,6 +945,7 @@ namespace pyrlk
if (x >= cols || y >= rows)
return;
int A11i = 0;
int A12i = 0;
int A22i = 0;
...
...
@@ -970,7 +973,6 @@ namespace pyrlk
{
if (calcErr)
err(y, x) = numeric_limits<float>::max();
return;
}
...
...
@@ -1014,6 +1016,7 @@ namespace pyrlk
}
}
float2 delta;
delta.x = A12 * b2 - A22 * b1;
delta.y = A12 * b1 - A11 * b2;
...
...
@@ -1083,11 +1086,11 @@ namespace pyrlk
funcs[patch.y - 1][patch.x - 1](I, J, I.rows, I.cols, prevPts, nextPts, status, err, ptcount,
level, block, stream);
}
static void dense(PtrStepSz
b
I, PtrStepSz<T> J, PtrStepSzf u, PtrStepSzf v, PtrStepSzf prevU, PtrStepSzf prevV, PtrStepSzf err, int2 winSize, cudaStream_t stream)
static void dense(PtrStepSz
<T>
I, PtrStepSz<T> J, PtrStepSzf u, PtrStepSzf v, PtrStepSzf prevU, PtrStepSzf prevV, PtrStepSzf err, int2 winSize, cudaStream_t stream)
{
dim3 block(16, 16);
dim3 grid(divUp(I.cols, block.x), divUp(I.rows, block.y));
Tex_I<1,
uchar
>::bindTexture_(I);
Tex_I<1,
T
>::bindTexture_(I);
Tex_J<1, T>::bindTexture_(J);
int2 halfWin = make_int2((winSize.x - 1) / 2, (winSize.y - 1) / 2);
...
...
modules/cudaoptflow/src/pyrlk.cpp
View file @
ff5eaadf
...
...
@@ -61,7 +61,7 @@ namespace pyrlk
static
void
sparse
(
PtrStepSz
<
typename
device
::
TypeVec
<
T
,
cn
>::
vec_type
>
I
,
PtrStepSz
<
typename
device
::
TypeVec
<
T
,
cn
>::
vec_type
>
J
,
const
float2
*
prevPts
,
float2
*
nextPts
,
uchar
*
status
,
float
*
err
,
int
ptcount
,
int
level
,
dim3
block
,
dim3
patch
,
cudaStream_t
stream
);
static
void
dense
(
PtrStepSz
b
I
,
PtrStepSzf
J
,
PtrStepSzf
u
,
PtrStepSzf
v
,
PtrStepSzf
prevU
,
PtrStepSzf
prevV
,
static
void
dense
(
PtrStepSz
f
I
,
PtrStepSzf
J
,
PtrStepSzf
u
,
PtrStepSzf
v
,
PtrStepSzf
prevU
,
PtrStepSzf
prevV
,
PtrStepSzf
err
,
int2
winSize
,
cudaStream_t
stream
);
};
...
...
@@ -236,7 +236,9 @@ namespace
prevPyr_
.
resize
(
maxLevel_
+
1
);
nextPyr_
.
resize
(
maxLevel_
+
1
);
prevPyr_
[
0
]
=
prevImg
;
//prevPyr_[0] = prevImg;
prevImg
.
convertTo
(
prevPyr_
[
0
],
CV_32F
,
stream
);
nextImg
.
convertTo
(
nextPyr_
[
0
],
CV_32F
,
stream
);
for
(
int
level
=
1
;
level
<=
maxLevel_
;
++
level
)
...
...
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