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
732bd621
Commit
732bd621
authored
Nov 22, 2010
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added masks support for bitwise operations on GPU
parent
3163cfb8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
33 deletions
+79
-33
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+28
-28
arithm.cpp
modules/gpu/src/arithm.cpp
+0
-0
mathfunc.cu
modules/gpu/src/cuda/mathfunc.cu
+0
-0
bitwise_oper.cpp
tests/gpu/src/bitwise_oper.cpp
+51
-5
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
732bd621
...
@@ -474,53 +474,53 @@ namespace cv
...
@@ -474,53 +474,53 @@ namespace cv
//! computes magnitude of each (x(i), y(i)) vector
//! computes magnitude of each (x(i), y(i)) vector
//! supports only floating-point source
//! supports only floating-point source
CV_EXPORTS
void
magnitude
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
);
CV_EXPORTS
void
magnitude
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
magnitude
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
,
const
Stream
&
stream
);
CV_EXPORTS
void
magnitude
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
,
const
Stream
&
stream
);
//! computes squared magnitude of each (x(i), y(i)) vector
//! computes squared magnitude of each (x(i), y(i)) vector
//! supports only floating-point source
//! supports only floating-point source
CV_EXPORTS
void
magnitudeSqr
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
);
CV_EXPORTS
void
magnitudeSqr
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
magnitudeSqr
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
,
const
Stream
&
stream
);
CV_EXPORTS
void
magnitudeSqr
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
,
const
Stream
&
stream
);
//! computes angle (angle(i)) of each (x(i), y(i)) vector
//! computes angle (angle(i)) of each (x(i), y(i)) vector
//! supports only floating-point source
//! supports only floating-point source
CV_EXPORTS
void
phase
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
angle
,
bool
angleInDegrees
=
false
);
CV_EXPORTS
void
phase
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
angle
,
bool
angleInDegrees
=
false
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
phase
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
angle
,
bool
angleInDegrees
,
const
Stream
&
stream
);
CV_EXPORTS
void
phase
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
angle
,
bool
angleInDegrees
,
const
Stream
&
stream
);
//! converts Cartesian coordinates to polar
//! converts Cartesian coordinates to polar
//! supports only floating-point source
//! supports only floating-point source
CV_EXPORTS
void
cartToPolar
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
,
GpuMat
&
angle
,
bool
angleInDegrees
=
false
);
CV_EXPORTS
void
cartToPolar
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
,
GpuMat
&
angle
,
bool
angleInDegrees
=
false
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
cartToPolar
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
,
GpuMat
&
angle
,
bool
angleInDegrees
,
const
Stream
&
stream
);
CV_EXPORTS
void
cartToPolar
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
magnitude
,
GpuMat
&
angle
,
bool
angleInDegrees
,
const
Stream
&
stream
);
//! converts polar coordinates to Cartesian
//! converts polar coordinates to Cartesian
//! supports only floating-point source
//! supports only floating-point source
CV_EXPORTS
void
polarToCart
(
const
GpuMat
&
magnitude
,
const
GpuMat
&
angle
,
GpuMat
&
x
,
GpuMat
&
y
,
bool
angleInDegrees
=
false
);
CV_EXPORTS
void
polarToCart
(
const
GpuMat
&
magnitude
,
const
GpuMat
&
angle
,
GpuMat
&
x
,
GpuMat
&
y
,
bool
angleInDegrees
=
false
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
polarToCart
(
const
GpuMat
&
magnitude
,
const
GpuMat
&
angle
,
GpuMat
&
x
,
GpuMat
&
y
,
bool
angleInDegrees
,
const
Stream
&
stream
);
CV_EXPORTS
void
polarToCart
(
const
GpuMat
&
magnitude
,
const
GpuMat
&
angle
,
GpuMat
&
x
,
GpuMat
&
y
,
bool
angleInDegrees
,
const
Stream
&
stream
);
//!
P
erfroms per-elements bit-wise inversion
//!
p
erfroms per-elements bit-wise inversion
CV_EXPORTS
void
bitwise_not
(
const
GpuMat
&
src
,
GpuMat
&
dst
);
CV_EXPORTS
void
bitwise_not
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
GpuMat
&
mask
=
GpuMat
()
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
bitwise_not
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
Stream
&
stream
);
CV_EXPORTS
void
bitwise_not
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
GpuMat
&
mask
,
const
Stream
&
stream
);
//!
C
alculates per-element bit-wise disjunction of two arrays
//!
c
alculates per-element bit-wise disjunction of two arrays
CV_EXPORTS
void
bitwise_or
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
);
CV_EXPORTS
void
bitwise_or
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
GpuMat
&
mask
=
GpuMat
()
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
bitwise_or
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
CV_EXPORTS
void
bitwise_or
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
GpuMat
&
mask
,
const
Stream
&
stream
);
//!
C
alculates per-element bit-wise conjunction of two arrays
//!
c
alculates per-element bit-wise conjunction of two arrays
CV_EXPORTS
void
bitwise_and
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
);
CV_EXPORTS
void
bitwise_and
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
GpuMat
&
mask
=
GpuMat
()
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
bitwise_and
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
CV_EXPORTS
void
bitwise_and
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
GpuMat
&
mask
,
const
Stream
&
stream
);
//!
C
alculates per-element bit-wise "exclusive or" operation
//!
c
alculates per-element bit-wise "exclusive or" operation
CV_EXPORTS
void
bitwise_xor
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
);
CV_EXPORTS
void
bitwise_xor
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
GpuMat
&
mask
=
GpuMat
()
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
bitwise_xor
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
CV_EXPORTS
void
bitwise_xor
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
GpuMat
&
mask
,
const
Stream
&
stream
);
//! Logical operators
//! Logical operators
CV_EXPORTS
GpuMat
operator
~
(
const
GpuMat
&
src
);
CV_EXPORTS
GpuMat
operator
~
(
const
GpuMat
&
src
);
...
@@ -551,7 +551,7 @@ namespace cv
...
@@ -551,7 +551,7 @@ namespace cv
//! Supported types of input disparity: CV_8U, CV_16S.
//! Supported types of input disparity: CV_8U, CV_16S.
//! Output disparity has CV_8UC4 type in BGRA format (alpha = 255).
//! Output disparity has CV_8UC4 type in BGRA format (alpha = 255).
CV_EXPORTS
void
drawColorDisp
(
const
GpuMat
&
src_disp
,
GpuMat
&
dst_disp
,
int
ndisp
);
CV_EXPORTS
void
drawColorDisp
(
const
GpuMat
&
src_disp
,
GpuMat
&
dst_disp
,
int
ndisp
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
drawColorDisp
(
const
GpuMat
&
src_disp
,
GpuMat
&
dst_disp
,
int
ndisp
,
const
Stream
&
stream
);
CV_EXPORTS
void
drawColorDisp
(
const
GpuMat
&
src_disp
,
GpuMat
&
dst_disp
,
int
ndisp
,
const
Stream
&
stream
);
//! Reprojects disparity image to 3D space.
//! Reprojects disparity image to 3D space.
...
@@ -560,12 +560,12 @@ namespace cv
...
@@ -560,12 +560,12 @@ namespace cv
//! Each element of this matrix will contain the 3D coordinates of the point (x,y,z,1), computed from the disparity map.
//! Each element of this matrix will contain the 3D coordinates of the point (x,y,z,1), computed from the disparity map.
//! Q is the 4x4 perspective transformation matrix that can be obtained with cvStereoRectify.
//! Q is the 4x4 perspective transformation matrix that can be obtained with cvStereoRectify.
CV_EXPORTS
void
reprojectImageTo3D
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
);
CV_EXPORTS
void
reprojectImageTo3D
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
reprojectImageTo3D
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
,
const
Stream
&
stream
);
CV_EXPORTS
void
reprojectImageTo3D
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
,
const
Stream
&
stream
);
//! converts image from one color space to another
//! converts image from one color space to another
CV_EXPORTS
void
cvtColor
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
=
0
);
CV_EXPORTS
void
cvtColor
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
=
0
);
//!
A
sync version
//!
a
sync version
CV_EXPORTS
void
cvtColor
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
,
const
Stream
&
stream
);
CV_EXPORTS
void
cvtColor
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
,
const
Stream
&
stream
);
//! applies fixed threshold to the image.
//! applies fixed threshold to the image.
...
@@ -821,7 +821,7 @@ namespace cv
...
@@ -821,7 +821,7 @@ namespace cv
//! Output disparity has CV_8U type.
//! Output disparity has CV_8U type.
void
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
);
void
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
);
//!
A
sync version
//!
a
sync version
void
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
const
Stream
&
stream
);
void
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
const
Stream
&
stream
);
//! Some heuristics that tries to estmate
//! Some heuristics that tries to estmate
...
@@ -876,7 +876,7 @@ namespace cv
...
@@ -876,7 +876,7 @@ namespace cv
//! if disparity is empty output type will be CV_16S else output type will be disparity.type().
//! if disparity is empty output type will be CV_16S else output type will be disparity.type().
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
);
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
);
//!
A
sync version
//!
a
sync version
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
Stream
&
stream
);
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
Stream
&
stream
);
...
@@ -935,7 +935,7 @@ namespace cv
...
@@ -935,7 +935,7 @@ namespace cv
//! if disparity is empty output type will be CV_16S else output type will be disparity.type().
//! if disparity is empty output type will be CV_16S else output type will be disparity.type().
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
);
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
);
//!
A
sync version
//!
a
sync version
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
Stream
&
stream
);
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
Stream
&
stream
);
int
ndisp
;
int
ndisp
;
...
@@ -991,7 +991,7 @@ namespace cv
...
@@ -991,7 +991,7 @@ namespace cv
//! disparity must have CV_8U or CV_16S type, image must have CV_8UC1 or CV_8UC3 type.
//! disparity must have CV_8U or CV_16S type, image must have CV_8UC1 or CV_8UC3 type.
void
operator
()(
const
GpuMat
&
disparity
,
const
GpuMat
&
image
,
GpuMat
&
dst
);
void
operator
()(
const
GpuMat
&
disparity
,
const
GpuMat
&
image
,
GpuMat
&
dst
);
//!
A
sync version
//!
a
sync version
void
operator
()(
const
GpuMat
&
disparity
,
const
GpuMat
&
image
,
GpuMat
&
dst
,
Stream
&
stream
);
void
operator
()(
const
GpuMat
&
disparity
,
const
GpuMat
&
image
,
GpuMat
&
dst
,
Stream
&
stream
);
private
:
private
:
...
...
modules/gpu/src/arithm.cpp
View file @
732bd621
This diff is collapsed.
Click to expand it.
modules/gpu/src/cuda/mathfunc.cu
View file @
732bd621
This diff is collapsed.
Click to expand it.
tests/gpu/src/bitwise_oper.cpp
View file @
732bd621
...
@@ -60,7 +60,7 @@ struct CV_GpuBitwiseTest: public CvTest
...
@@ -60,7 +60,7 @@ struct CV_GpuBitwiseTest: public CvTest
int
rows
,
cols
;
int
rows
,
cols
;
for
(
int
depth
=
CV_8U
;
depth
<=
CV_64F
;
++
depth
)
for
(
int
depth
=
CV_8U
;
depth
<=
CV_64F
;
++
depth
)
for
(
int
cn
=
1
;
cn
<=
4
;
++
cn
)
for
(
int
cn
=
1
;
cn
<=
4
;
++
cn
)
for
(
int
attempt
=
0
;
attempt
<
5
;
++
attempt
)
for
(
int
attempt
=
0
;
attempt
<
3
;
++
attempt
)
{
{
rows
=
1
+
rand
()
%
100
;
rows
=
1
+
rand
()
%
100
;
cols
=
1
+
rand
()
%
100
;
cols
=
1
+
rand
()
%
100
;
...
@@ -83,7 +83,12 @@ struct CV_GpuBitwiseTest: public CvTest
...
@@ -83,7 +83,12 @@ struct CV_GpuBitwiseTest: public CvTest
}
}
Mat
dst_gold
=
~
src
;
Mat
dst_gold
=
~
src
;
gpu
::
GpuMat
dst
=
~
gpu
::
GpuMat
(
src
);
gpu
::
GpuMat
mask
(
src
.
size
(),
CV_8U
);
mask
.
setTo
(
Scalar
(
1
));
gpu
::
GpuMat
dst
;
gpu
::
bitwise_not
(
gpu
::
GpuMat
(
src
),
dst
,
mask
);
CHECK
(
dst_gold
.
size
()
==
dst
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
size
()
==
dst
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
type
()
==
dst
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
type
()
==
dst
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
...
@@ -112,10 +117,23 @@ struct CV_GpuBitwiseTest: public CvTest
...
@@ -112,10 +117,23 @@ struct CV_GpuBitwiseTest: public CvTest
CHECK
(
dst_gold
.
size
()
==
dst
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
size
()
==
dst
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
type
()
==
dst
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
type
()
==
dst
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
Mat
dsth
(
dst
);
Mat
dsth
(
dst
);
for
(
int
i
=
0
;
i
<
dst_gold
.
rows
;
++
i
)
for
(
int
i
=
0
;
i
<
dst_gold
.
rows
;
++
i
)
CHECK
(
memcmp
(
dst_gold
.
ptr
(
i
),
dsth
.
ptr
(
i
),
dst_gold
.
cols
*
dst_gold
.
elemSize
())
==
0
,
CvTS
::
FAIL_INVALID_OUTPUT
)
CHECK
(
memcmp
(
dst_gold
.
ptr
(
i
),
dsth
.
ptr
(
i
),
dst_gold
.
cols
*
dst_gold
.
elemSize
())
==
0
,
CvTS
::
FAIL_INVALID_OUTPUT
)
Mat
mask
(
src1
.
size
(),
CV_8U
);
randu
(
mask
,
Scalar
(
0
),
Scalar
(
255
));
Mat
dst_gold2
(
dst_gold
.
size
(),
dst_gold
.
type
());
dst_gold2
.
setTo
(
Scalar
::
all
(
0
));
gpu
::
GpuMat
dst2
(
dst
.
size
(),
dst
.
type
());
dst2
.
setTo
(
Scalar
::
all
(
0
));
bitwise_or
(
src1
,
src2
,
dst_gold2
,
mask
);
gpu
::
bitwise_or
(
gpu
::
GpuMat
(
src1
),
gpu
::
GpuMat
(
src2
),
dst2
,
gpu
::
GpuMat
(
mask
));
CHECK
(
dst_gold2
.
size
()
==
dst2
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold2
.
type
()
==
dst2
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
dsth
=
dst2
;
for
(
int
i
=
0
;
i
<
dst_gold
.
rows
;
++
i
)
CHECK
(
memcmp
(
dst_gold2
.
ptr
(
i
),
dsth
.
ptr
(
i
),
dst_gold2
.
cols
*
dst_gold2
.
elemSize
())
==
0
,
CvTS
::
FAIL_INVALID_OUTPUT
)
}
}
void
test_bitwise_and
(
int
rows
,
int
cols
,
int
type
)
void
test_bitwise_and
(
int
rows
,
int
cols
,
int
type
)
...
@@ -138,10 +156,24 @@ struct CV_GpuBitwiseTest: public CvTest
...
@@ -138,10 +156,24 @@ struct CV_GpuBitwiseTest: public CvTest
CHECK
(
dst_gold
.
size
()
==
dst
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
size
()
==
dst
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
type
()
==
dst
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
type
()
==
dst
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
Mat
dsth
(
dst
);
Mat
dsth
(
dst
);
for
(
int
i
=
0
;
i
<
dst_gold
.
rows
;
++
i
)
for
(
int
i
=
0
;
i
<
dst_gold
.
rows
;
++
i
)
CHECK
(
memcmp
(
dst_gold
.
ptr
(
i
),
dsth
.
ptr
(
i
),
dst_gold
.
cols
*
dst_gold
.
elemSize
())
==
0
,
CvTS
::
FAIL_INVALID_OUTPUT
)
CHECK
(
memcmp
(
dst_gold
.
ptr
(
i
),
dsth
.
ptr
(
i
),
dst_gold
.
cols
*
dst_gold
.
elemSize
())
==
0
,
CvTS
::
FAIL_INVALID_OUTPUT
)
Mat
mask
(
src1
.
size
(),
CV_8U
);
randu
(
mask
,
Scalar
(
0
),
Scalar
(
255
));
Mat
dst_gold2
(
dst_gold
.
size
(),
dst_gold
.
type
());
dst_gold2
.
setTo
(
Scalar
::
all
(
0
));
gpu
::
GpuMat
dst2
(
dst
.
size
(),
dst
.
type
());
dst2
.
setTo
(
Scalar
::
all
(
0
));
bitwise_and
(
src1
,
src2
,
dst_gold2
,
mask
);
gpu
::
bitwise_and
(
gpu
::
GpuMat
(
src1
),
gpu
::
GpuMat
(
src2
),
dst2
,
gpu
::
GpuMat
(
mask
));
CHECK
(
dst_gold2
.
size
()
==
dst2
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold2
.
type
()
==
dst2
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
dsth
=
dst2
;
for
(
int
i
=
0
;
i
<
dst_gold
.
rows
;
++
i
)
CHECK
(
memcmp
(
dst_gold2
.
ptr
(
i
),
dsth
.
ptr
(
i
),
dst_gold2
.
cols
*
dst_gold2
.
elemSize
())
==
0
,
CvTS
::
FAIL_INVALID_OUTPUT
)
}
}
void
test_bitwise_xor
(
int
rows
,
int
cols
,
int
type
)
void
test_bitwise_xor
(
int
rows
,
int
cols
,
int
type
)
...
@@ -164,10 +196,24 @@ struct CV_GpuBitwiseTest: public CvTest
...
@@ -164,10 +196,24 @@ struct CV_GpuBitwiseTest: public CvTest
CHECK
(
dst_gold
.
size
()
==
dst
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
size
()
==
dst
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
type
()
==
dst
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold
.
type
()
==
dst
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
Mat
dsth
(
dst
);
Mat
dsth
(
dst
);
for
(
int
i
=
0
;
i
<
dst_gold
.
rows
;
++
i
)
for
(
int
i
=
0
;
i
<
dst_gold
.
rows
;
++
i
)
CHECK
(
memcmp
(
dst_gold
.
ptr
(
i
),
dsth
.
ptr
(
i
),
dst_gold
.
cols
*
dst_gold
.
elemSize
())
==
0
,
CvTS
::
FAIL_INVALID_OUTPUT
)
CHECK
(
memcmp
(
dst_gold
.
ptr
(
i
),
dsth
.
ptr
(
i
),
dst_gold
.
cols
*
dst_gold
.
elemSize
())
==
0
,
CvTS
::
FAIL_INVALID_OUTPUT
)
Mat
mask
(
src1
.
size
(),
CV_8U
);
randu
(
mask
,
Scalar
(
0
),
Scalar
(
255
));
Mat
dst_gold2
(
dst_gold
.
size
(),
dst_gold
.
type
());
dst_gold2
.
setTo
(
Scalar
::
all
(
0
));
gpu
::
GpuMat
dst2
(
dst
.
size
(),
dst
.
type
());
dst2
.
setTo
(
Scalar
::
all
(
0
));
bitwise_xor
(
src1
,
src2
,
dst_gold2
,
mask
);
gpu
::
bitwise_xor
(
gpu
::
GpuMat
(
src1
),
gpu
::
GpuMat
(
src2
),
dst2
,
gpu
::
GpuMat
(
mask
));
CHECK
(
dst_gold2
.
size
()
==
dst2
.
size
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
CHECK
(
dst_gold2
.
type
()
==
dst2
.
type
(),
CvTS
::
FAIL_INVALID_OUTPUT
);
dsth
=
dst2
;
for
(
int
i
=
0
;
i
<
dst_gold
.
rows
;
++
i
)
CHECK
(
memcmp
(
dst_gold2
.
ptr
(
i
),
dsth
.
ptr
(
i
),
dst_gold2
.
cols
*
dst_gold2
.
elemSize
())
==
0
,
CvTS
::
FAIL_INVALID_OUTPUT
)
}
}
}
gpu_bitwise_test
;
}
gpu_bitwise_test
;
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