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
a7e5a488
Commit
a7e5a488
authored
Jan 20, 2014
by
vbystricky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change method of setting arguments to kernel to safe one
parent
e96ba814
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
lkpyramid.cpp
modules/video/src/lkpyramid.cpp
+30
-0
No files found.
modules/video/src/lkpyramid.cpp
View file @
a7e5a488
...
...
@@ -708,6 +708,16 @@ namespace cv
block
.
z
=
patch
.
z
=
1
;
}
#define SAFE_KERNEL_SET_ARG(idx, arg) \
{\
int idxNew = kernel.set(idx, arg);\
if (-1 == idxNew)\
{\
printf("lkSparse_run can't setup argument index = %d to kernel\n");\
return false;\
}\
idx = idxNew;\
}
bool
lkSparse_run
(
UMat
&
I
,
UMat
&
J
,
const
UMat
&
prevPts
,
UMat
&
nextPts
,
UMat
&
status
,
UMat
&
err
,
int
ptcount
,
int
level
)
{
...
...
@@ -728,6 +738,7 @@ namespace cv
ocl
::
Image2D
imageI
(
I
);
ocl
::
Image2D
imageJ
(
J
);
int
idxArg
=
0
;
#if 0
idxArg = kernel.set(idxArg, imageI); //image2d_t I
idxArg = kernel.set(idxArg, imageJ); //image2d_t J
idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(prevPts)); // __global const float2* prevPts
...
...
@@ -745,6 +756,25 @@ namespace cv
idxArg = kernel.set(idxArg, (int)winSize.height); // int c_winSize_y
idxArg = kernel.set(idxArg, (int)iters); // int c_iters
idxArg = kernel.set(idxArg, (char)calcErr); //char calcErr
#else
SAFE_KERNEL_SET_ARG
(
idxArg
,
imageI
);
//image2d_t I
SAFE_KERNEL_SET_ARG
(
idxArg
,
imageJ
);
//image2d_t J
SAFE_KERNEL_SET_ARG
(
idxArg
,
ocl
::
KernelArg
::
PtrReadOnly
(
prevPts
));
// __global const float2* prevPts
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
prevPts
.
step
);
// int prevPtsStep
SAFE_KERNEL_SET_ARG
(
idxArg
,
ocl
::
KernelArg
::
PtrReadWrite
(
nextPts
));
// __global const float2* nextPts
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
nextPts
.
step
);
// int nextPtsStep
SAFE_KERNEL_SET_ARG
(
idxArg
,
ocl
::
KernelArg
::
PtrReadWrite
(
status
));
// __global uchar* status
SAFE_KERNEL_SET_ARG
(
idxArg
,
ocl
::
KernelArg
::
PtrReadWrite
(
err
));
// __global float* err
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
level
);
// const int level
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
I
.
rows
);
// const int rows
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
I
.
cols
);
// const int cols
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
patch
.
x
);
// int PATCH_X
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
patch
.
y
);
// int PATCH_Y
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
winSize
.
width
);
// int c_winSize_x
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
winSize
.
height
);
// int c_winSize_y
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
int
)
iters
);
// int c_iters
SAFE_KERNEL_SET_ARG
(
idxArg
,
(
char
)
calcErr
);
//char calcErr
#endif
return
kernel
.
run
(
2
,
globalThreads
,
localThreads
,
true
);
}
...
...
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