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
9df6e51a
Commit
9df6e51a
authored
May 12, 2012
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added gpu::compare with scalars (Feature #1754)
parent
abe16352
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
10 deletions
+173
-10
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+2
-1
element_operations.cu
modules/gpu/src/cuda/element_operations.cu
+0
-0
element_operations.cpp
modules/gpu/src/element_operations.cpp
+64
-5
test_core.cpp
modules/gpu/test/test_core.cpp
+107
-4
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
9df6e51a
...
@@ -527,6 +527,7 @@ CV_EXPORTS void pow(const GpuMat& src, double power, GpuMat& dst, Stream& stream
...
@@ -527,6 +527,7 @@ CV_EXPORTS void pow(const GpuMat& src, double power, GpuMat& dst, Stream& stream
//! compares elements of two arrays (c = a <cmpop> b)
//! compares elements of two arrays (c = a <cmpop> b)
CV_EXPORTS
void
compare
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
int
cmpop
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
compare
(
const
GpuMat
&
a
,
const
GpuMat
&
b
,
GpuMat
&
c
,
int
cmpop
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
compare
(
const
GpuMat
&
a
,
Scalar
sc
,
GpuMat
&
dst
,
int
cmpop
,
Stream
&
stream
=
Stream
::
Null
());
//! performs per-elements bit-wise inversion
//! performs per-elements bit-wise inversion
CV_EXPORTS
void
bitwise_not
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
GpuMat
&
mask
=
GpuMat
(),
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
bitwise_not
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
GpuMat
&
mask
=
GpuMat
(),
Stream
&
stream
=
Stream
::
Null
());
...
@@ -1371,7 +1372,7 @@ private:
...
@@ -1371,7 +1372,7 @@ private:
std
::
vector
<
GpuMat
>
trainDescCollection
;
std
::
vector
<
GpuMat
>
trainDescCollection
;
};
};
template
<
class
Distance
>
template
<
class
Distance
>
class
CV_EXPORTS
BruteForceMatcher_GPU
;
class
CV_EXPORTS
BruteForceMatcher_GPU
;
template
<
typename
T
>
template
<
typename
T
>
...
...
modules/gpu/src/cuda/element_operations.cu
View file @
9df6e51a
This diff is collapsed.
Click to expand it.
modules/gpu/src/element_operations.cpp
View file @
9df6e51a
...
@@ -64,6 +64,7 @@ void cv::gpu::sqrt(const GpuMat&, GpuMat&, Stream&) { throw_nogpu(); }
...
@@ -64,6 +64,7 @@ void cv::gpu::sqrt(const GpuMat&, GpuMat&, Stream&) { throw_nogpu(); }
void
cv
::
gpu
::
exp
(
const
GpuMat
&
,
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
exp
(
const
GpuMat
&
,
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
log
(
const
GpuMat
&
,
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
log
(
const
GpuMat
&
,
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
compare
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
int
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
compare
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
int
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
compare
(
const
GpuMat
&
,
Scalar
,
GpuMat
&
,
int
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_not
(
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_not
(
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_or
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_or
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_or
(
const
GpuMat
&
,
const
Scalar
&
,
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_or
(
const
GpuMat
&
,
const
Scalar
&
,
GpuMat
&
,
Stream
&
)
{
throw_nogpu
();
}
...
@@ -1357,17 +1358,24 @@ void cv::gpu::exp(const GpuMat& src, GpuMat& dst, Stream& stream)
...
@@ -1357,17 +1358,24 @@ void cv::gpu::exp(const GpuMat& src, GpuMat& dst, Stream& stream)
namespace
cv
{
namespace
gpu
{
namespace
device
namespace
cv
{
namespace
gpu
{
namespace
device
{
{
template
<
typename
T
>
void
compare_eq
(
const
DevMem2Db
&
src1
,
const
DevMem2Db
&
src2
,
const
DevMem2Db
&
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_eq
(
DevMem2Db
src1
,
DevMem2Db
src2
,
DevMem2Db
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_ne
(
const
DevMem2Db
&
src1
,
const
DevMem2Db
&
src2
,
const
DevMem2Db
&
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_ne
(
DevMem2Db
src1
,
DevMem2Db
src2
,
DevMem2Db
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_lt
(
const
DevMem2Db
&
src1
,
const
DevMem2Db
&
src2
,
const
DevMem2Db
&
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_lt
(
DevMem2Db
src1
,
DevMem2Db
src2
,
DevMem2Db
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_le
(
const
DevMem2Db
&
src1
,
const
DevMem2Db
&
src2
,
const
DevMem2Db
&
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_le
(
DevMem2Db
src1
,
DevMem2Db
src2
,
DevMem2Db
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_eq
(
DevMem2Db
src
,
int
cn
,
double
val
[
4
],
DevMem2Db
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_ne
(
DevMem2Db
src
,
int
cn
,
double
val
[
4
],
DevMem2Db
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_lt
(
DevMem2Db
src
,
int
cn
,
double
val
[
4
],
DevMem2Db
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_le
(
DevMem2Db
src
,
int
cn
,
double
val
[
4
],
DevMem2Db
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_gt
(
DevMem2Db
src
,
int
cn
,
double
val
[
4
],
DevMem2Db
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
compare_ge
(
DevMem2Db
src
,
int
cn
,
double
val
[
4
],
DevMem2Db
dst
,
cudaStream_t
stream
);
}}}
}}}
void
cv
::
gpu
::
compare
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
int
cmpop
,
Stream
&
stream
)
void
cv
::
gpu
::
compare
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
int
cmpop
,
Stream
&
stream
)
{
{
using
namespace
cv
::
gpu
::
device
;
using
namespace
cv
::
gpu
::
device
;
typedef
void
(
*
func_t
)(
const
DevMem2Db
&
src1
,
const
DevMem2Db
&
src2
,
const
DevMem2Db
&
dst
,
cudaStream_t
stream
);
typedef
void
(
*
func_t
)(
DevMem2Db
src1
,
DevMem2Db
src2
,
DevMem2Db
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[
7
][
4
]
=
static
const
func_t
funcs
[
7
][
4
]
=
{
{
{
compare_eq
<
unsigned
char
>
,
compare_ne
<
unsigned
char
>
,
compare_lt
<
unsigned
char
>
,
compare_le
<
unsigned
char
>
},
{
compare_eq
<
unsigned
char
>
,
compare_ne
<
unsigned
char
>
,
compare_lt
<
unsigned
char
>
,
compare_le
<
unsigned
char
>
},
...
@@ -1407,6 +1415,57 @@ void cv::gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int c
...
@@ -1407,6 +1415,57 @@ void cv::gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int c
funcs
[
src1
.
depth
()][
codes
[
cmpop
]](
psrc1
[
cmpop
]
->
reshape
(
1
),
psrc2
[
cmpop
]
->
reshape
(
1
),
dst
.
reshape
(
1
),
StreamAccessor
::
getStream
(
stream
));
funcs
[
src1
.
depth
()][
codes
[
cmpop
]](
psrc1
[
cmpop
]
->
reshape
(
1
),
psrc2
[
cmpop
]
->
reshape
(
1
),
dst
.
reshape
(
1
),
StreamAccessor
::
getStream
(
stream
));
}
}
namespace
{
template
<
typename
T
>
void
castScalar
(
Scalar
&
sc
)
{
sc
.
val
[
0
]
=
saturate_cast
<
T
>
(
sc
.
val
[
0
]);
sc
.
val
[
1
]
=
saturate_cast
<
T
>
(
sc
.
val
[
1
]);
sc
.
val
[
2
]
=
saturate_cast
<
T
>
(
sc
.
val
[
2
]);
sc
.
val
[
3
]
=
saturate_cast
<
T
>
(
sc
.
val
[
3
]);
}
}
void
cv
::
gpu
::
compare
(
const
GpuMat
&
src
,
Scalar
sc
,
GpuMat
&
dst
,
int
cmpop
,
Stream
&
stream
)
{
using
namespace
cv
::
gpu
::
device
;
typedef
void
(
*
func_t
)(
DevMem2Db
src
,
int
cn
,
double
val
[
4
],
DevMem2Db
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[
7
][
6
]
=
{
{
compare_eq
<
unsigned
char
>
,
compare_gt
<
unsigned
char
>
,
compare_ge
<
unsigned
char
>
,
compare_lt
<
unsigned
char
>
,
compare_le
<
unsigned
char
>
,
compare_ne
<
unsigned
char
>
},
{
compare_eq
<
signed
char
>
,
compare_gt
<
signed
char
>
,
compare_ge
<
signed
char
>
,
compare_lt
<
signed
char
>
,
compare_le
<
signed
char
>
,
compare_ne
<
signed
char
>
},
{
compare_eq
<
unsigned
short
>
,
compare_gt
<
unsigned
short
>
,
compare_ge
<
unsigned
short
>
,
compare_lt
<
unsigned
short
>
,
compare_le
<
unsigned
short
>
,
compare_ne
<
unsigned
short
>
},
{
compare_eq
<
short
>
,
compare_gt
<
short
>
,
compare_ge
<
short
>
,
compare_lt
<
short
>
,
compare_le
<
short
>
,
compare_ne
<
short
>
},
{
compare_eq
<
int
>
,
compare_gt
<
int
>
,
compare_ge
<
int
>
,
compare_lt
<
int
>
,
compare_le
<
int
>
,
compare_ne
<
int
>
},
{
compare_eq
<
float
>
,
compare_gt
<
float
>
,
compare_ge
<
float
>
,
compare_lt
<
float
>
,
compare_le
<
float
>
,
compare_ne
<
float
>
},
{
compare_eq
<
double
>
,
compare_gt
<
double
>
,
compare_ge
<
double
>
,
compare_lt
<
double
>
,
compare_le
<
double
>
,
compare_ne
<
double
>
}
};
typedef
void
(
*
cast_func_t
)(
Scalar
&
sc
);
static
const
cast_func_t
cast_func
[]
=
{
castScalar
<
unsigned
char
>
,
castScalar
<
signed
char
>
,
castScalar
<
unsigned
short
>
,
castScalar
<
short
>
,
castScalar
<
int
>
,
castScalar
<
float
>
,
castScalar
<
double
>
};
CV_Assert
(
src
.
depth
()
<=
CV_64F
);
CV_Assert
(
src
.
channels
()
<=
4
);
CV_Assert
(
cmpop
>=
CMP_EQ
&&
cmpop
<=
CMP_NE
);
if
(
src
.
depth
()
==
CV_64F
)
{
if
(
!
TargetArchs
::
builtWith
(
NATIVE_DOUBLE
)
||
!
DeviceInfo
().
supports
(
NATIVE_DOUBLE
))
CV_Error
(
CV_StsUnsupportedFormat
,
"The device doesn't support double"
);
}
dst
.
create
(
src
.
size
(),
CV_MAKE_TYPE
(
CV_8U
,
src
.
channels
()));
cast_func
[
src
.
depth
()](
sc
);
funcs
[
src
.
depth
()][
cmpop
](
src
,
src
.
channels
(),
sc
.
val
,
dst
,
StreamAccessor
::
getStream
(
stream
));
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Unary bitwise logical operations
// Unary bitwise logical operations
...
...
modules/gpu/test/test_core.cpp
View file @
9df6e51a
...
@@ -1480,12 +1480,12 @@ INSTANTIATE_TEST_CASE_P(GPU_Core, Exp, testing::Combine(
...
@@ -1480,12 +1480,12 @@ INSTANTIATE_TEST_CASE_P(GPU_Core, Exp, testing::Combine(
WHOLE_SUBMAT
));
WHOLE_SUBMAT
));
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
compare
//
Compare_Array
CV_ENUM
(
CmpCode
,
cv
::
CMP_EQ
,
cv
::
CMP_GT
,
cv
::
CMP_GE
,
cv
::
CMP_LT
,
cv
::
CMP_LE
,
cv
::
CMP_NE
)
CV_ENUM
(
CmpCode
,
cv
::
CMP_EQ
,
cv
::
CMP_GT
,
cv
::
CMP_GE
,
cv
::
CMP_LT
,
cv
::
CMP_LE
,
cv
::
CMP_NE
)
#define ALL_CMP_CODES testing::Values(CmpCode(cv::CMP_EQ), CmpCode(cv::CMP_NE), CmpCode(cv::CMP_GT), CmpCode(cv::CMP_GE), CmpCode(cv::CMP_LT), CmpCode(cv::CMP_LE))
#define ALL_CMP_CODES testing::Values(CmpCode(cv::CMP_EQ), CmpCode(cv::CMP_NE), CmpCode(cv::CMP_GT), CmpCode(cv::CMP_GE), CmpCode(cv::CMP_LT), CmpCode(cv::CMP_LE))
PARAM_TEST_CASE
(
Compare
,
cv
::
gpu
::
DeviceInfo
,
cv
::
Size
,
MatDepth
,
CmpCode
,
UseRoi
)
PARAM_TEST_CASE
(
Compare
_Array
,
cv
::
gpu
::
DeviceInfo
,
cv
::
Size
,
MatDepth
,
CmpCode
,
UseRoi
)
{
{
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
Size
size
;
cv
::
Size
size
;
...
@@ -1505,7 +1505,7 @@ PARAM_TEST_CASE(Compare, cv::gpu::DeviceInfo, cv::Size, MatDepth, CmpCode, UseRo
...
@@ -1505,7 +1505,7 @@ PARAM_TEST_CASE(Compare, cv::gpu::DeviceInfo, cv::Size, MatDepth, CmpCode, UseRo
}
}
};
};
TEST_P
(
Compare
,
Accuracy
)
TEST_P
(
Compare
_Array
,
Accuracy
)
{
{
cv
::
Mat
src1
=
randomMat
(
size
,
depth
);
cv
::
Mat
src1
=
randomMat
(
size
,
depth
);
cv
::
Mat
src2
=
randomMat
(
size
,
depth
);
cv
::
Mat
src2
=
randomMat
(
size
,
depth
);
...
@@ -1534,13 +1534,116 @@ TEST_P(Compare, Accuracy)
...
@@ -1534,13 +1534,116 @@ TEST_P(Compare, Accuracy)
}
}
}
}
INSTANTIATE_TEST_CASE_P
(
GPU_Core
,
Compare
,
testing
::
Combine
(
INSTANTIATE_TEST_CASE_P
(
GPU_Core
,
Compare
_Array
,
testing
::
Combine
(
ALL_DEVICES
,
ALL_DEVICES
,
DIFFERENT_SIZES
,
DIFFERENT_SIZES
,
ALL_DEPTH
,
ALL_DEPTH
,
ALL_CMP_CODES
,
ALL_CMP_CODES
,
WHOLE_SUBMAT
));
WHOLE_SUBMAT
));
////////////////////////////////////////////////////////////////////////////////
// Compare_Scalar
namespace
{
template
<
template
<
typename
>
class
Op
,
typename
T
>
void
compareScalarImpl
(
const
cv
::
Mat
&
src
,
cv
::
Scalar
sc
,
cv
::
Mat
&
dst
)
{
Op
<
T
>
op
;
const
int
cn
=
src
.
channels
();
dst
.
create
(
src
.
size
(),
CV_MAKE_TYPE
(
CV_8U
,
cn
));
for
(
int
y
=
0
;
y
<
src
.
rows
;
++
y
)
{
for
(
int
x
=
0
;
x
<
src
.
cols
;
++
x
)
{
for
(
int
c
=
0
;
c
<
cn
;
++
c
)
{
T
src_val
=
src
.
at
<
T
>
(
y
,
x
*
cn
+
c
);
T
sc_val
=
cv
::
saturate_cast
<
T
>
(
sc
.
val
[
c
]);
dst
.
at
<
uchar
>
(
y
,
x
*
cn
+
c
)
=
static_cast
<
uchar
>
(
static_cast
<
int
>
(
op
(
src_val
,
sc_val
))
*
255
);
}
}
}
}
void
compareScalarGold
(
const
cv
::
Mat
&
src
,
cv
::
Scalar
sc
,
cv
::
Mat
&
dst
,
int
cmpop
)
{
typedef
void
(
*
func_t
)(
const
cv
::
Mat
&
src
,
cv
::
Scalar
sc
,
cv
::
Mat
&
dst
);
static
const
func_t
funcs
[
7
][
6
]
=
{
{
compareScalarImpl
<
std
::
equal_to
,
unsigned
char
>
,
compareScalarImpl
<
std
::
greater
,
unsigned
char
>
,
compareScalarImpl
<
std
::
greater_equal
,
unsigned
char
>
,
compareScalarImpl
<
std
::
less
,
unsigned
char
>
,
compareScalarImpl
<
std
::
less_equal
,
unsigned
char
>
,
compareScalarImpl
<
std
::
not_equal_to
,
unsigned
char
>
},
{
compareScalarImpl
<
std
::
equal_to
,
signed
char
>
,
compareScalarImpl
<
std
::
greater
,
signed
char
>
,
compareScalarImpl
<
std
::
greater_equal
,
signed
char
>
,
compareScalarImpl
<
std
::
less
,
signed
char
>
,
compareScalarImpl
<
std
::
less_equal
,
signed
char
>
,
compareScalarImpl
<
std
::
not_equal_to
,
signed
char
>
},
{
compareScalarImpl
<
std
::
equal_to
,
unsigned
short
>
,
compareScalarImpl
<
std
::
greater
,
unsigned
short
>
,
compareScalarImpl
<
std
::
greater_equal
,
unsigned
short
>
,
compareScalarImpl
<
std
::
less
,
unsigned
short
>
,
compareScalarImpl
<
std
::
less_equal
,
unsigned
short
>
,
compareScalarImpl
<
std
::
not_equal_to
,
unsigned
short
>
},
{
compareScalarImpl
<
std
::
equal_to
,
short
>
,
compareScalarImpl
<
std
::
greater
,
short
>
,
compareScalarImpl
<
std
::
greater_equal
,
short
>
,
compareScalarImpl
<
std
::
less
,
short
>
,
compareScalarImpl
<
std
::
less_equal
,
short
>
,
compareScalarImpl
<
std
::
not_equal_to
,
short
>
},
{
compareScalarImpl
<
std
::
equal_to
,
int
>
,
compareScalarImpl
<
std
::
greater
,
int
>
,
compareScalarImpl
<
std
::
greater_equal
,
int
>
,
compareScalarImpl
<
std
::
less
,
int
>
,
compareScalarImpl
<
std
::
less_equal
,
int
>
,
compareScalarImpl
<
std
::
not_equal_to
,
int
>
},
{
compareScalarImpl
<
std
::
equal_to
,
float
>
,
compareScalarImpl
<
std
::
greater
,
float
>
,
compareScalarImpl
<
std
::
greater_equal
,
float
>
,
compareScalarImpl
<
std
::
less
,
float
>
,
compareScalarImpl
<
std
::
less_equal
,
float
>
,
compareScalarImpl
<
std
::
not_equal_to
,
float
>
},
{
compareScalarImpl
<
std
::
equal_to
,
double
>
,
compareScalarImpl
<
std
::
greater
,
double
>
,
compareScalarImpl
<
std
::
greater_equal
,
double
>
,
compareScalarImpl
<
std
::
less
,
double
>
,
compareScalarImpl
<
std
::
less_equal
,
double
>
,
compareScalarImpl
<
std
::
not_equal_to
,
double
>
}
};
funcs
[
src
.
depth
()][
cmpop
](
src
,
sc
,
dst
);
}
}
PARAM_TEST_CASE
(
Compare_Scalar
,
cv
::
gpu
::
DeviceInfo
,
cv
::
Size
,
MatType
,
CmpCode
,
UseRoi
)
{
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
Size
size
;
int
type
;
int
cmp_code
;
bool
useRoi
;
virtual
void
SetUp
()
{
devInfo
=
GET_PARAM
(
0
);
size
=
GET_PARAM
(
1
);
type
=
GET_PARAM
(
2
);
cmp_code
=
GET_PARAM
(
3
);
useRoi
=
GET_PARAM
(
4
);
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
}
};
TEST_P
(
Compare_Scalar
,
Accuracy
)
{
cv
::
Mat
src
=
randomMat
(
size
,
type
);
cv
::
Scalar
sc
=
randomScalar
(
0.0
,
255.0
);
if
(
src
.
depth
()
==
CV_64F
&&
!
supportFeature
(
devInfo
,
cv
::
gpu
::
NATIVE_DOUBLE
))
{
try
{
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
compare
(
loadMat
(
src
),
sc
,
dst
,
cmp_code
);
}
catch
(
const
cv
::
Exception
&
e
)
{
ASSERT_EQ
(
CV_StsUnsupportedFormat
,
e
.
code
);
}
}
else
{
cv
::
gpu
::
GpuMat
dst
=
createMat
(
size
,
CV_MAKE_TYPE
(
CV_8U
,
src
.
channels
()),
useRoi
);
cv
::
gpu
::
compare
(
loadMat
(
src
,
useRoi
),
sc
,
dst
,
cmp_code
);
cv
::
Mat
dst_gold
;
compareScalarGold
(
src
,
sc
,
dst_gold
,
cmp_code
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
0.0
);
}
}
INSTANTIATE_TEST_CASE_P
(
GPU_Core
,
Compare_Scalar
,
testing
::
Combine
(
ALL_DEVICES
,
DIFFERENT_SIZES
,
TYPES
(
CV_8U
,
CV_64F
,
1
,
4
),
ALL_CMP_CODES
,
WHOLE_SUBMAT
));
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Bitwise_Array
// Bitwise_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