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
ed749c4b
Commit
ed749c4b
authored
Oct 10, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added missing arithm operations to gpu module
parent
f947c2eb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
49 deletions
+47
-49
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+31
-33
element_operations.cu
modules/gpu/src/cuda/element_operations.cu
+0
-0
element_operations.cpp
modules/gpu/src/element_operations.cpp
+0
-0
filtering.cpp
modules/gpu/src/filtering.cpp
+3
-3
test_arithm.cpp
modules/gpu/test/test_arithm.cpp
+11
-11
test_imgproc.cpp
modules/gpu/test/test_imgproc.cpp
+2
-2
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
ed749c4b
...
...
@@ -539,32 +539,41 @@ namespace cv
//////////////////////////// Per-element operations ////////////////////////////////////
//! adds one matrix to another (c = a + b)
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS
void
add
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
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)
//! supports CV_32FC1 and CV_32FC2 type
CV_EXPORTS
void
add
(
const
GpuMat
&
a
,
const
Scalar
&
sc
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
add
(
const
GpuMat
&
a
,
const
Scalar
&
sc
,
GpuMat
&
c
,
const
GpuMat
&
mask
=
GpuMat
(),
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! subtracts one matrix from another (c = a - b)
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS
void
subtract
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
subtract
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
const
GpuMat
&
mask
=
GpuMat
(),
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! subtracts scalar from a matrix (c = a - s)
//! supports CV_32FC1 and CV_32FC2 type
CV_EXPORTS
void
subtract
(
const
GpuMat
&
a
,
const
Scalar
&
sc
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise product of the two arrays (c = a * b)
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS
void
multiply
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
//! multiplies matrix to a scalar (c = a * s)
//! supports CV_32FC1 type
CV_EXPORTS
void
multiply
(
const
GpuMat
&
a
,
const
Scalar
&
sc
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise quotient of the two arrays (c = a / b)
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS
void
divide
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise quotient of matrix and scalar (c = a / s)
//! supports CV_32FC1 type
CV_EXPORTS
void
divide
(
const
GpuMat
&
a
,
const
Scalar
&
sc
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
subtract
(
const
GpuMat
&
a
,
const
Scalar
&
sc
,
GpuMat
&
c
,
const
GpuMat
&
mask
=
GpuMat
(),
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise weighted product of the two arrays (c = scale * a * b)
CV_EXPORTS
void
multiply
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
double
scale
=
1
,
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! weighted multiplies matrix to a scalar (c = scale * a * s)
CV_EXPORTS
void
multiply
(
const
GpuMat
&
a
,
const
Scalar
&
sc
,
GpuMat
&
c
,
double
scale
=
1
,
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise weighted quotient of the two arrays (c = a / b)
CV_EXPORTS
void
divide
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
double
scale
=
1
,
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise weighted quotient of matrix and scalar (c = a / s)
CV_EXPORTS
void
divide
(
const
GpuMat
&
a
,
const
Scalar
&
sc
,
GpuMat
&
c
,
double
scale
=
1
,
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise weighted reciprocal of an array (dst = scale/src2)
CV_EXPORTS
void
divide
(
double
scale
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! computes the weighted sum of two arrays (dst = alpha*src1 + beta*src2 + gamma)
CV_EXPORTS
void
addWeighted
(
const
GpuMat
&
src1
,
double
alpha
,
const
GpuMat
&
src2
,
double
beta
,
double
gamma
,
GpuMat
&
dst
,
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
//! adds scaled array to another one (dst = alpha*src1 + src2)
static
inline
void
scaleAdd
(
const
GpuMat
&
src1
,
double
alpha
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
Stream
&
stream
=
Stream
::
Null
())
{
addWeighted
(
src1
,
alpha
,
src2
,
1.0
,
0.0
,
dst
,
-
1
,
stream
);
}
//! computes element-wise absolute difference of two arrays (c = abs(a - b))
CV_EXPORTS
void
absdiff
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise absolute difference of array and scalar (c = abs(a - s))
CV_EXPORTS
void
absdiff
(
const
GpuMat
&
a
,
const
Scalar
&
s
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
//! computes exponent of each matrix element (b = e**a)
//! supports only CV_32FC1 type
...
...
@@ -580,13 +589,6 @@ namespace cv
//! supports only CV_32FC1 type
CV_EXPORTS
void
log
(
const
GpuMat
&
a
,
GpuMat
&
b
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise absolute difference of two arrays (c = abs(a - b))
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS
void
absdiff
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
//! computes element-wise absolute difference of array and scalar (c = abs(a - s))
//! supports only CV_32FC1 type
CV_EXPORTS
void
absdiff
(
const
GpuMat
&
a
,
const
Scalar
&
s
,
GpuMat
&
c
,
Stream
&
stream
=
Stream
::
Null
());
//! compares elements of two arrays (c = a <cmpop> b)
//! supports CV_8UC4, CV_32FC1 types
CV_EXPORTS
void
compare
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
int
cmpop
,
Stream
&
stream
=
Stream
::
Null
());
...
...
@@ -615,10 +617,6 @@ namespace cv
//! computes per-element maximum of array and scalar (dst = max(src1, src2))
CV_EXPORTS
void
max
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
Stream
&
stream
=
Stream
::
Null
());
//! computes the weighted sum of two arrays
CV_EXPORTS
void
addWeighted
(
const
GpuMat
&
src1
,
double
alpha
,
const
GpuMat
&
src2
,
double
beta
,
double
gamma
,
GpuMat
&
dst
,
int
dtype
=
-
1
,
Stream
&
stream
=
Stream
::
Null
());
////////////////////////////// Image processing //////////////////////////////
...
...
modules/gpu/src/cuda/element_operations.cu
View file @
ed749c4b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
modules/gpu/src/element_operations.cpp
View file @
ed749c4b
This diff is collapsed.
Click to expand it.
modules/gpu/src/filtering.cpp
View file @
ed749c4b
...
...
@@ -639,17 +639,17 @@ void cv::gpu::morphologyEx(const GpuMat& src, GpuMat& dst, int op, const Mat& ke
case
CV_MOP_GRADIENT
:
erode
(
src
,
buf2
,
kernel
,
buf1
,
anchor
,
iterations
,
stream
);
dilate
(
src
,
dst
,
kernel
,
buf1
,
anchor
,
iterations
,
stream
);
subtract
(
dst
,
buf2
,
dst
,
stream
);
subtract
(
dst
,
buf2
,
dst
,
GpuMat
(),
-
1
,
stream
);
break
;
case
CV_MOP_TOPHAT
:
erode
(
src
,
dst
,
kernel
,
buf1
,
anchor
,
iterations
,
stream
);
dilate
(
dst
,
buf2
,
kernel
,
buf1
,
anchor
,
iterations
,
stream
);
subtract
(
src
,
buf2
,
dst
,
stream
);
subtract
(
src
,
buf2
,
dst
,
GpuMat
(),
-
1
,
stream
);
break
;
case
CV_MOP_BLACKHAT
:
dilate
(
src
,
dst
,
kernel
,
buf1
,
anchor
,
iterations
,
stream
);
erode
(
dst
,
buf2
,
kernel
,
buf1
,
anchor
,
iterations
,
stream
);
subtract
(
buf2
,
src
,
dst
,
stream
);
subtract
(
buf2
,
src
,
dst
,
GpuMat
(),
-
1
,
stream
);
break
;
default
:
CV_Error
(
CV_StsBadArg
,
"unknown morphological operation"
);
...
...
modules/gpu/test/test_arithm.cpp
View file @
ed749c4b
...
...
@@ -96,7 +96,7 @@ TEST_P(AddArray, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
AddArray
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_32SC1
,
CV_32FC1
)));
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_
16UC1
,
CV_
32SC1
,
CV_32FC1
)));
struct
AddScalar
:
ArithmTest
{};
...
...
@@ -130,7 +130,7 @@ TEST_P(AddScalar, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
AddScalar
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_32FC1
,
CV_32FC2
)));
testing
::
Values
(
CV_
8UC1
,
CV_16UC1
,
CV_32SC1
,
CV_
32FC1
,
CV_32FC2
)));
////////////////////////////////////////////////////////////////////////////////
// subtract
...
...
@@ -161,7 +161,7 @@ TEST_P(SubtractArray, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
SubtractArray
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_32SC1
,
CV_32FC1
)));
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_
16UC1
,
CV_
32SC1
,
CV_32FC1
)));
struct
SubtractScalar
:
ArithmTest
{};
...
...
@@ -195,7 +195,7 @@ TEST_P(SubtractScalar, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
SubtractScalar
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_32FC1
,
CV_32FC2
)));
testing
::
Values
(
CV_
8UC1
,
CV_16UC1
,
CV_32SC1
,
CV_
32FC1
,
CV_32FC2
)));
////////////////////////////////////////////////////////////////////////////////
// multiply
...
...
@@ -226,7 +226,7 @@ TEST_P(MultiplyArray, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
MultiplyArray
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_32SC1
,
CV_32FC1
)));
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_
16UC1
,
CV_
32SC1
,
CV_32FC1
)));
struct
MultiplyScalar
:
ArithmTest
{};
...
...
@@ -260,7 +260,7 @@ TEST_P(MultiplyScalar, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
MultiplyScalar
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_32FC1
)));
testing
::
Values
(
CV_
8UC1
,
CV_16UC1
,
CV_32SC1
,
CV_
32FC1
)));
////////////////////////////////////////////////////////////////////////////////
// divide
...
...
@@ -291,7 +291,7 @@ TEST_P(DivideArray, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
DivideArray
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_32SC1
,
CV_32FC1
)));
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_
16UC1
,
CV_
32SC1
,
CV_32FC1
)));
struct
DivideScalar
:
ArithmTest
{};
...
...
@@ -325,7 +325,7 @@ TEST_P(DivideScalar, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
DivideScalar
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_32FC1
)));
testing
::
Values
(
CV_
8UC1
,
CV_16UC1
,
CV_32SC1
,
CV_
32FC1
)));
////////////////////////////////////////////////////////////////////////////////
// transpose
...
...
@@ -387,7 +387,7 @@ TEST_P(AbsdiffArray, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
AbsdiffArray
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_32SC1
,
CV_32FC1
)));
testing
::
Values
(
CV_8UC1
,
CV_8UC4
,
CV_
16UC1
,
CV_
32SC1
,
CV_32FC1
)));
struct
AbsdiffScalar
:
ArithmTest
{};
...
...
@@ -421,7 +421,7 @@ TEST_P(AbsdiffScalar, Accuracy)
INSTANTIATE_TEST_CASE_P
(
Arithm
,
AbsdiffScalar
,
testing
::
Combine
(
testing
::
ValuesIn
(
devices
()),
testing
::
Values
(
CV_32FC1
)));
testing
::
Values
(
CV_
8UC1
,
CV_16UC1
,
CV_32SC1
,
CV_
32FC1
)));
////////////////////////////////////////////////////////////////////////////////
// compare
...
...
@@ -813,7 +813,7 @@ TEST_P(Pow, Accuracy)
/*std::cout << mat << std::endl << std::endl;
std::cout << dst << std::endl << std::endl;
std::cout << dst_gold << std::endl;*/
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
1
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
2
);
}
INSTANTIATE_TEST_CASE_P
(
Arithm
,
Pow
,
testing
::
Combine
(
...
...
modules/gpu/test/test_imgproc.cpp
View file @
ed749c4b
...
...
@@ -169,8 +169,8 @@ TEST_P(Resize, Accuracy)
gpuRes2
.
download
(
dst2
);
);
EXPECT_MAT_SIMILAR
(
dst_gold1
,
dst1
,
0.2
);
EXPECT_MAT_SIMILAR
(
dst_gold2
,
dst2
,
0.2
);
EXPECT_MAT_SIMILAR
(
dst_gold1
,
dst1
,
0.2
1
);
EXPECT_MAT_SIMILAR
(
dst_gold2
,
dst2
,
0.2
1
);
}
INSTANTIATE_TEST_CASE_P
(
ImgProc
,
Resize
,
testing
::
Combine
(
...
...
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