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
4ebbf691
Commit
4ebbf691
authored
Apr 25, 2013
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switched to Input/Output Array in gpu::add
parent
7a07f1a9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
4 deletions
+90
-4
gpuarithm.hpp
modules/gpuarithm/include/opencv2/gpuarithm.hpp
+2
-4
element_operations.cpp
modules/gpuarithm/src/element_operations.cpp
+0
-0
test_element_operations.cpp
modules/gpuarithm/test/test_element_operations.cpp
+88
-0
No files found.
modules/gpuarithm/include/opencv2/gpuarithm.hpp
View file @
4ebbf691
...
...
@@ -51,10 +51,8 @@
namespace
cv
{
namespace
gpu
{
//! adds one matrix to another (c = a + b)
CV_EXPORTS
void
add
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
const
GpuMat
&
mask
=
GpuMat
(),
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! adds scalar to a matrix (c = a + s)
CV_EXPORTS
void
add
(
const
GpuMat
&
a
,
const
Scalar
&
sc
,
GpuMat
&
c
,
const
GpuMat
&
mask
=
GpuMat
(),
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! adds one matrix to another (dst = src1 + src2)
CV_EXPORTS
void
add
(
InputArray
src1
,
InputArray
src2
,
OutputArray
dst
,
InputArray
mask
=
noArray
(),
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! subtracts one matrix from another (c = a - b)
CV_EXPORTS
void
subtract
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
const
GpuMat
&
mask
=
GpuMat
(),
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
...
...
modules/gpuarithm/src/element_operations.cpp
View file @
4ebbf691
This diff is collapsed.
Click to expand it.
modules/gpuarithm/test/test_element_operations.cpp
View file @
4ebbf691
...
...
@@ -261,6 +261,94 @@ INSTANTIATE_TEST_CASE_P(GPU_Arithm, Add_Scalar, testing::Combine(
DEPTH_PAIRS
,
WHOLE_SUBMAT
));
////////////////////////////////////////////////////////////////////////////////
// Add_Scalar_First
PARAM_TEST_CASE
(
Add_Scalar_First
,
cv
::
gpu
::
DeviceInfo
,
cv
::
Size
,
std
::
pair
<
MatDepth
,
MatDepth
>
,
UseRoi
)
{
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
Size
size
;
std
::
pair
<
MatDepth
,
MatDepth
>
depth
;
bool
useRoi
;
virtual
void
SetUp
()
{
devInfo
=
GET_PARAM
(
0
);
size
=
GET_PARAM
(
1
);
depth
=
GET_PARAM
(
2
);
useRoi
=
GET_PARAM
(
3
);
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
}
};
GPU_TEST_P
(
Add_Scalar_First
,
WithOutMask
)
{
cv
::
Mat
mat
=
randomMat
(
size
,
depth
.
first
);
cv
::
Scalar
val
=
randomScalar
(
0
,
255
);
if
((
depth
.
first
==
CV_64F
||
depth
.
second
==
CV_64F
)
&&
!
supportFeature
(
devInfo
,
cv
::
gpu
::
NATIVE_DOUBLE
))
{
try
{
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
add
(
val
,
loadMat
(
mat
),
dst
,
cv
::
gpu
::
GpuMat
(),
depth
.
second
);
}
catch
(
const
cv
::
Exception
&
e
)
{
ASSERT_EQ
(
cv
::
Error
::
StsUnsupportedFormat
,
e
.
code
);
}
}
else
{
cv
::
gpu
::
GpuMat
dst
=
createMat
(
size
,
depth
.
second
,
useRoi
);
dst
.
setTo
(
cv
::
Scalar
::
all
(
0
));
cv
::
gpu
::
add
(
val
,
loadMat
(
mat
,
useRoi
),
dst
,
cv
::
gpu
::
GpuMat
(),
depth
.
second
);
cv
::
Mat
dst_gold
(
size
,
depth
.
second
,
cv
::
Scalar
::
all
(
0
));
cv
::
add
(
val
,
mat
,
dst_gold
,
cv
::
noArray
(),
depth
.
second
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
depth
.
first
>=
CV_32F
||
depth
.
second
>=
CV_32F
?
1e-4
:
0.0
);
}
}
GPU_TEST_P
(
Add_Scalar_First
,
WithMask
)
{
cv
::
Mat
mat
=
randomMat
(
size
,
depth
.
first
);
cv
::
Scalar
val
=
randomScalar
(
0
,
255
);
cv
::
Mat
mask
=
randomMat
(
size
,
CV_8UC1
,
0.0
,
2.0
);
if
((
depth
.
first
==
CV_64F
||
depth
.
second
==
CV_64F
)
&&
!
supportFeature
(
devInfo
,
cv
::
gpu
::
NATIVE_DOUBLE
))
{
try
{
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
add
(
val
,
loadMat
(
mat
),
dst
,
cv
::
gpu
::
GpuMat
(),
depth
.
second
);
}
catch
(
const
cv
::
Exception
&
e
)
{
ASSERT_EQ
(
cv
::
Error
::
StsUnsupportedFormat
,
e
.
code
);
}
}
else
{
cv
::
gpu
::
GpuMat
dst
=
createMat
(
size
,
depth
.
second
,
useRoi
);
dst
.
setTo
(
cv
::
Scalar
::
all
(
0
));
cv
::
gpu
::
add
(
val
,
loadMat
(
mat
,
useRoi
),
dst
,
loadMat
(
mask
,
useRoi
),
depth
.
second
);
cv
::
Mat
dst_gold
(
size
,
depth
.
second
,
cv
::
Scalar
::
all
(
0
));
cv
::
add
(
val
,
mat
,
dst_gold
,
mask
,
depth
.
second
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
depth
.
first
>=
CV_32F
||
depth
.
second
>=
CV_32F
?
1e-4
:
0.0
);
}
}
INSTANTIATE_TEST_CASE_P
(
GPU_Arithm
,
Add_Scalar_First
,
testing
::
Combine
(
ALL_DEVICES
,
DIFFERENT_SIZES
,
DEPTH_PAIRS
,
WHOLE_SUBMAT
));
////////////////////////////////////////////////////////////////////////////////
// Subtract_Array
...
...
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