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
48a084c2
Commit
48a084c2
authored
Jan 27, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OpenCL version of cv::buildPyramid
parent
d9b24457
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
0 deletions
+57
-0
mat.hpp
modules/core/include/opencv2/core/mat.hpp
+1
-0
matrix.cpp
modules/core/src/matrix.cpp
+17
-0
perf_pyramid.cpp
modules/imgproc/perf/opencl/perf_pyramid.cpp
+29
-0
pyramids.cpp
modules/imgproc/src/pyramids.cpp
+10
-0
No files found.
modules/core/include/opencv2/core/mat.hpp
View file @
48a084c2
...
...
@@ -207,6 +207,7 @@ public:
virtual
bool
fixedType
()
const
;
virtual
bool
needed
()
const
;
virtual
Mat
&
getMatRef
(
int
i
=-
1
)
const
;
virtual
UMat
&
getUMatRef
(
int
i
=-
1
)
const
;
virtual
cuda
::
GpuMat
&
getGpuMatRef
()
const
;
virtual
ogl
::
Buffer
&
getOGlBufferRef
()
const
;
virtual
cuda
::
CudaMem
&
getCudaMemRef
()
const
;
...
...
modules/core/src/matrix.cpp
View file @
48a084c2
...
...
@@ -2484,6 +2484,23 @@ Mat& _OutputArray::getMatRef(int i) const
}
}
UMat
&
_OutputArray
::
getUMatRef
(
int
i
)
const
{
int
k
=
kind
();
if
(
i
<
0
)
{
CV_Assert
(
k
==
UMAT
);
return
*
(
UMat
*
)
obj
;
}
else
{
CV_Assert
(
k
==
STD_VECTOR_UMAT
);
std
::
vector
<
UMat
>&
v
=
*
(
std
::
vector
<
UMat
>*
)
obj
;
CV_Assert
(
i
<
(
int
)
v
.
size
()
);
return
v
[
i
];
}
}
cuda
::
GpuMat
&
_OutputArray
::
getGpuMatRef
()
const
{
int
k
=
kind
();
...
...
modules/imgproc/perf/opencl/perf_pyramid.cpp
View file @
48a084c2
...
...
@@ -100,6 +100,35 @@ OCL_PERF_TEST_P(PyrUpFixture, PyrUp,
SANITY_CHECK
(
dst
,
eps
);
}
///////////// buildPyramid ////////////////////////
typedef
Size_MatType
BuildPyramidFixture
;
OCL_PERF_TEST_P
(
BuildPyramidFixture
,
BuildPyramid
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
maxLevel
=
5
;
const
double
eps
=
CV_MAT_DEPTH
(
type
)
<=
CV_32S
?
1
:
1e-5
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
std
::
vector
<
UMat
>
dst
(
maxLevel
);
UMat
src
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
);
OCL_TEST_CYCLE
()
cv
::
buildPyramid
(
src
,
dst
,
maxLevel
);
UMat
dst0
=
dst
[
0
],
dst1
=
dst
[
1
],
dst2
=
dst
[
2
],
dst3
=
dst
[
3
],
dst4
=
dst
[
4
];
SANITY_CHECK
(
dst0
,
eps
);
SANITY_CHECK
(
dst1
,
eps
);
SANITY_CHECK
(
dst2
,
eps
);
SANITY_CHECK
(
dst3
,
eps
);
SANITY_CHECK
(
dst4
,
eps
);
}
}
}
// namespace cvtest::ocl
#endif // HAVE_OPENCL
modules/imgproc/src/pyramids.cpp
View file @
48a084c2
...
...
@@ -556,6 +556,16 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderT
void
cv
::
buildPyramid
(
InputArray
_src
,
OutputArrayOfArrays
_dst
,
int
maxlevel
,
int
borderType
)
{
if
(
_src
.
dims
()
<=
2
&&
_dst
.
isUMatVector
())
{
UMat
src
=
_src
.
getUMat
();
_dst
.
create
(
maxlevel
+
1
,
1
,
0
);
_dst
.
getUMatRef
(
0
)
=
src
;
for
(
int
i
=
1
;
i
<=
maxlevel
;
i
++
)
pyrDown
(
_dst
.
getUMatRef
(
i
-
1
),
_dst
.
getUMatRef
(
i
),
Size
(),
borderType
);
return
;
}
Mat
src
=
_src
.
getMat
();
_dst
.
create
(
maxlevel
+
1
,
1
,
0
);
_dst
.
getMatRef
(
0
)
=
src
;
...
...
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