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
caba92f2
Commit
caba92f2
authored
Oct 24, 2014
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3284 from vbystricky:oclopt_stereoBM
parents
63383ef1
21ad8e92
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
stereobm.cl
modules/calib3d/src/opencl/stereobm.cl
+0
-0
stereobm.cpp
modules/calib3d/src/stereobm.cpp
+16
-17
No files found.
modules/calib3d/src/opencl/stereobm.cl
View file @
caba92f2
This diff is collapsed.
Click to expand it.
modules/calib3d/src/stereobm.cpp
View file @
caba92f2
...
...
@@ -88,7 +88,7 @@ struct StereoBMParams
static
bool
ocl_prefilter_norm
(
InputArray
_input
,
OutputArray
_output
,
int
winsize
,
int
prefilterCap
)
{
ocl
::
Kernel
k
(
"prefilter_norm"
,
ocl
::
calib3d
::
stereobm_oclsrc
);
ocl
::
Kernel
k
(
"prefilter_norm"
,
ocl
::
calib3d
::
stereobm_oclsrc
,
cv
::
format
(
"-D WSZ=%d"
,
winsize
)
);
if
(
k
.
empty
())
return
false
;
...
...
@@ -102,7 +102,7 @@ static bool ocl_prefilter_norm(InputArray _input, OutputArray _output, int winsi
size_t
globalThreads
[
3
]
=
{
input
.
cols
,
input
.
rows
,
1
};
k
.
args
(
ocl
::
KernelArg
::
PtrReadOnly
(
input
),
ocl
::
KernelArg
::
PtrWriteOnly
(
output
),
input
.
rows
,
input
.
cols
,
prefilterCap
,
winsize
,
scale_g
,
scale_s
);
prefilterCap
,
scale_g
,
scale_s
);
return
k
.
run
(
2
,
globalThreads
,
NULL
,
false
);
}
...
...
@@ -743,9 +743,16 @@ static bool ocl_stereobm( InputArray _left, InputArray _right,
int
wsz
=
state
->
SADWindowSize
;
int
wsz2
=
wsz
/
2
;
int
sizeX
=
std
::
max
(
11
,
27
-
ocl
::
Device
::
getDefault
().
maxComputeUnits
()
),
sizeY
=
sizeX
-
1
,
N
=
ndisp
*
2
;
ocl
::
Device
devDef
=
ocl
::
Device
::
getDefault
();
int
sizeX
=
devDef
.
isIntel
()
?
32
:
std
::
max
(
11
,
27
-
devDef
.
maxComputeUnits
()),
sizeY
=
sizeX
-
1
,
N
=
ndisp
*
2
;
ocl
::
Kernel
k
(
"stereoBM"
,
ocl
::
calib3d
::
stereobm_oclsrc
,
cv
::
format
(
"-D csize=%d -D wsz=%d"
,
(
2
*
sizeY
)
*
ndisp
,
wsz
)
);
cv
::
String
opt
=
cv
::
format
(
"-D DEFINE_KERNEL_STEREOBM -D MIN_DISP=%d -D NUM_DISP=%d"
" -D BLOCK_SIZE_X=%d -D BLOCK_SIZE_Y=%d -D WSZ=%d"
,
mindisp
,
ndisp
,
sizeX
,
sizeY
,
wsz
);
ocl
::
Kernel
k
(
"stereoBM"
,
ocl
::
calib3d
::
stereobm_oclsrc
,
opt
);
if
(
k
.
empty
())
return
false
;
...
...
@@ -753,15 +760,14 @@ static bool ocl_stereobm( InputArray _left, InputArray _right,
int
cols
=
left
.
cols
,
rows
=
left
.
rows
;
_disp
.
create
(
_left
.
size
(),
CV_16S
);
_disp
.
setTo
((
mindisp
-
1
)
<<
4
);
_disp
.
setTo
((
mindisp
-
1
)
<<
4
);
Rect
roi
=
Rect
(
Point
(
wsz2
+
mindisp
+
ndisp
-
1
,
wsz2
),
Point
(
cols
-
wsz2
-
mindisp
,
rows
-
wsz2
)
);
UMat
disp
=
(
_disp
.
getUMat
())(
roi
);
int
globalX
=
disp
.
cols
/
sizeX
,
globalY
=
disp
.
rows
/
sizeY
;
globalX
+=
(
disp
.
cols
%
sizeX
)
>
0
?
1
:
0
;
globalY
+=
(
disp
.
rows
%
sizeY
)
>
0
?
1
:
0
;
size_t
globalThreads
[
3
]
=
{
globalX
,
globalY
,
N
};
size_t
localThreads
[
3
]
=
{
1
,
1
,
N
};
int
globalX
=
(
disp
.
cols
+
sizeX
-
1
)
/
sizeX
,
globalY
=
(
disp
.
rows
+
sizeY
-
1
)
/
sizeY
;
size_t
globalThreads
[
3
]
=
{
N
,
globalX
,
globalY
};
size_t
localThreads
[
3
]
=
{
N
,
1
,
1
};
int
idx
=
0
;
idx
=
k
.
set
(
idx
,
ocl
::
KernelArg
::
PtrReadOnly
(
left
));
...
...
@@ -769,15 +775,8 @@ static bool ocl_stereobm( InputArray _left, InputArray _right,
idx
=
k
.
set
(
idx
,
ocl
::
KernelArg
::
WriteOnlyNoSize
(
disp
));
idx
=
k
.
set
(
idx
,
rows
);
idx
=
k
.
set
(
idx
,
cols
);
idx
=
k
.
set
(
idx
,
mindisp
);
idx
=
k
.
set
(
idx
,
ndisp
);
idx
=
k
.
set
(
idx
,
state
->
preFilterCap
);
idx
=
k
.
set
(
idx
,
state
->
textureThreshold
);
idx
=
k
.
set
(
idx
,
state
->
uniquenessRatio
);
idx
=
k
.
set
(
idx
,
sizeX
);
idx
=
k
.
set
(
idx
,
sizeY
);
idx
=
k
.
set
(
idx
,
wsz
);
return
k
.
run
(
3
,
globalThreads
,
localThreads
,
false
);
}
...
...
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