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
0d09352f
Commit
0d09352f
authored
Jun 15, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed gpu::cvtColor
parent
ada3e6e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
59 deletions
+59
-59
color.cu
modules/gpu/src/cuda/color.cu
+0
-0
limits_gpu.hpp
modules/gpu/src/opencv2/gpu/device/limits_gpu.hpp
+27
-27
test_imgproc_gpu.cpp
modules/gpu/test/test_imgproc_gpu.cpp
+32
-32
No files found.
modules/gpu/src/cuda/color.cu
View file @
0d09352f
This diff is collapsed.
Click to expand it.
modules/gpu/src/opencv2/gpu/device/limits_gpu.hpp
View file @
0d09352f
...
...
@@ -44,11 +44,11 @@
#define __OPENCV_GPU_LIMITS_GPU_HPP__
namespace
cv
{
namespace
gpu
{
namespace
device
{
{
template
<
class
T
>
struct
numeric_limits_gpu
{
{
typedef
T
type
;
__device__
__forceinline__
static
type
min
()
{
return
type
();
};
__device__
__forceinline__
static
type
min
()
{
return
type
();
};
__device__
__forceinline__
static
type
max
()
{
return
type
();
};
__device__
__forceinline__
static
type
epsilon
()
{
return
type
();
}
__device__
__forceinline__
static
type
round_error
()
{
return
type
();
}
...
...
@@ -60,9 +60,9 @@ namespace cv { namespace gpu { namespace device
};
template
<>
struct
numeric_limits_gpu
<
bool
>
{
{
typedef
bool
type
;
__device__
__forceinline__
static
type
min
()
{
return
false
;
};
__device__
__forceinline__
static
type
min
()
{
return
false
;
};
__device__
__forceinline__
static
type
max
()
{
return
true
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -74,9 +74,9 @@ namespace cv { namespace gpu { namespace device
};
template
<>
struct
numeric_limits_gpu
<
char
>
{
{
typedef
char
type
;
__device__
__forceinline__
static
type
min
()
{
return
CHAR_MIN
;
};
__device__
__forceinline__
static
type
min
()
{
return
CHAR_MIN
;
};
__device__
__forceinline__
static
type
max
()
{
return
CHAR_MAX
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -88,9 +88,9 @@ namespace cv { namespace gpu { namespace device
};
template
<>
struct
numeric_limits_gpu
<
unsigned
char
>
{
{
typedef
unsigned
char
type
;
__device__
__forceinline__
static
type
min
()
{
return
0
;
};
__device__
__forceinline__
static
type
min
()
{
return
0
;
};
__device__
__forceinline__
static
type
max
()
{
return
UCHAR_MAX
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -102,9 +102,9 @@ namespace cv { namespace gpu { namespace device
};
template
<>
struct
numeric_limits_gpu
<
short
>
{
{
typedef
short
type
;
__device__
__forceinline__
static
type
min
()
{
return
SHRT_MIN
;
};
__device__
__forceinline__
static
type
min
()
{
return
SHRT_MIN
;
};
__device__
__forceinline__
static
type
max
()
{
return
SHRT_MAX
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -116,9 +116,9 @@ namespace cv { namespace gpu { namespace device
};
template
<>
struct
numeric_limits_gpu
<
unsigned
short
>
{
{
typedef
unsigned
short
type
;
__device__
__forceinline__
static
type
min
()
{
return
0
;
};
__device__
__forceinline__
static
type
min
()
{
return
0
;
};
__device__
__forceinline__
static
type
max
()
{
return
USHRT_MAX
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -130,9 +130,9 @@ namespace cv { namespace gpu { namespace device
};
template
<>
struct
numeric_limits_gpu
<
int
>
{
{
typedef
int
type
;
__device__
__forceinline__
static
type
min
()
{
return
INT_MIN
;
};
__device__
__forceinline__
static
type
min
()
{
return
INT_MIN
;
};
__device__
__forceinline__
static
type
max
()
{
return
INT_MAX
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -145,9 +145,9 @@ namespace cv { namespace gpu { namespace device
template
<>
struct
numeric_limits_gpu
<
unsigned
int
>
{
{
typedef
unsigned
int
type
;
__device__
__forceinline__
static
type
min
()
{
return
0
;
};
__device__
__forceinline__
static
type
min
()
{
return
0
;
};
__device__
__forceinline__
static
type
max
()
{
return
UINT_MAX
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -159,9 +159,9 @@ namespace cv { namespace gpu { namespace device
};
template
<>
struct
numeric_limits_gpu
<
long
>
{
{
typedef
long
type
;
__device__
__forceinline__
static
type
min
()
{
return
LONG_MIN
;
};
__device__
__forceinline__
static
type
min
()
{
return
LONG_MIN
;
};
__device__
__forceinline__
static
type
max
()
{
return
LONG_MAX
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -173,9 +173,9 @@ namespace cv { namespace gpu { namespace device
};
template
<>
struct
numeric_limits_gpu
<
unsigned
long
>
{
{
typedef
unsigned
long
type
;
__device__
__forceinline__
static
type
min
()
{
return
0
;
};
__device__
__forceinline__
static
type
min
()
{
return
0
;
};
__device__
__forceinline__
static
type
max
()
{
return
ULONG_MAX
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -185,11 +185,11 @@ namespace cv { namespace gpu { namespace device
__device__
__forceinline__
static
type
signaling_NaN
();
static
const
bool
is_signed
=
false
;
};
template
<>
struct
numeric_limits_gpu
<
float
>
{
{
typedef
float
type
;
__device__
__forceinline__
static
type
min
()
{
return
1.175494351e-38
f
/*FLT_MIN*/
;
};
__device__
__forceinline__
static
type
min
()
{
return
1.175494351e-38
f
/*FLT_MIN*/
;
};
__device__
__forceinline__
static
type
max
()
{
return
3.402823466e+38
f
/*FLT_MAX*/
;
};
__device__
__forceinline__
static
type
epsilon
()
{
return
1.192092896e-07
f
/*FLT_EPSILON*/
;
};
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -201,9 +201,9 @@ namespace cv { namespace gpu { namespace device
};
template
<>
struct
numeric_limits_gpu
<
double
>
{
{
typedef
double
type
;
__device__
__forceinline__
static
type
min
()
{
return
2.2250738585072014e-308
/*DBL_MIN*/
;
};
__device__
__forceinline__
static
type
min
()
{
return
2.2250738585072014e-308
/*DBL_MIN*/
;
};
__device__
__forceinline__
static
type
max
()
{
return
1.7976931348623158e+308
/*DBL_MAX*/
;
};
__device__
__forceinline__
static
type
epsilon
();
__device__
__forceinline__
static
type
round_error
();
...
...
@@ -212,7 +212,7 @@ namespace cv { namespace gpu { namespace device
__device__
__forceinline__
static
type
quiet_NaN
();
__device__
__forceinline__
static
type
signaling_NaN
();
static
const
bool
is_signed
=
true
;
};
};
}}}
#endif // __OPENCV_GPU_LIMITS_GPU_HPP__
modules/gpu/test/test_imgproc_gpu.cpp
View file @
0d09352f
...
...
@@ -461,17 +461,17 @@ protected:
int
CV_GpuCvtColorTest
::
CheckNorm
(
const
Mat
&
m1
,
const
Mat
&
m2
)
{
double
ret
=
norm
(
m1
,
m2
,
NORM_INF
)
;
float
max_err
=
1e-2
f
;
if
(
ret
<=
3
)
{
return
cvtest
::
TS
::
OK
;
}
else
{
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"
\n
Norm: %f
\n
"
,
ret
)
;
return
cvtest
::
TS
::
FAIL_GENERIC
;
}
Mat
diff
;
cv
::
matchTemplate
(
m1
,
m2
,
diff
,
CV_TM_CCORR_NORMED
);
float
err
=
abs
(
diff
.
at
<
float
>
(
0
,
0
)
-
1.
f
);
if
(
err
>
max_err
)
return
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
;
return
cvtest
::
TS
::
OK
;
}
void
CV_GpuCvtColorTest
::
run
(
int
)
...
...
@@ -596,7 +596,7 @@ void CV_GpuHistogramsTest::run( int )
////////////////////////////////////////////////////////////////////////
// Corner Harris feature detector
struct
CV_GpuCornerHarrisTest
:
cvtest
::
BaseTest
struct
CV_GpuCornerHarrisTest
:
cvtest
::
BaseTest
{
CV_GpuCornerHarrisTest
()
{}
...
...
@@ -616,7 +616,7 @@ struct CV_GpuCornerHarrisTest: cvtest::BaseTest
{
RNG
rng
;
cv
::
Mat
src
(
rows
,
cols
,
depth
);
if
(
depth
==
CV_32F
)
if
(
depth
==
CV_32F
)
rng
.
fill
(
src
,
RNG
::
UNIFORM
,
cv
::
Scalar
(
0
),
cv
::
Scalar
(
1
));
else
if
(
depth
==
CV_8U
)
rng
.
fill
(
src
,
RNG
::
UNIFORM
,
cv
::
Scalar
(
0
),
cv
::
Scalar
(
256
));
...
...
@@ -629,7 +629,7 @@ struct CV_GpuCornerHarrisTest: cvtest::BaseTest
int
borderType
;
borderType
=
BORDER_REFLECT101
;
cv
::
cornerHarris
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
cornerHarris
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
gpu
::
cornerHarris
(
cv
::
gpu
::
GpuMat
(
src
),
dst
,
blockSize
,
apertureSize
,
k
,
borderType
);
dsth
=
dst
;
...
...
@@ -639,7 +639,7 @@ struct CV_GpuCornerHarrisTest: cvtest::BaseTest
{
float
a
=
dst_gold
.
at
<
float
>
(
i
,
j
);
float
b
=
dsth
.
at
<
float
>
(
i
,
j
);
if
(
fabs
(
a
-
b
)
>
1e-3
f
)
if
(
fabs
(
a
-
b
)
>
1e-3
f
)
{
ts
->
printf
(
cvtest
::
TS
::
CONSOLE
,
"%d %d %f %f %d
\n
"
,
i
,
j
,
a
,
b
,
apertureSize
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
...
...
@@ -649,7 +649,7 @@ struct CV_GpuCornerHarrisTest: cvtest::BaseTest
}
borderType
=
BORDER_REPLICATE
;
cv
::
cornerHarris
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
cornerHarris
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
gpu
::
cornerHarris
(
cv
::
gpu
::
GpuMat
(
src
),
dst
,
blockSize
,
apertureSize
,
k
,
borderType
);
dsth
=
dst
;
...
...
@@ -659,7 +659,7 @@ struct CV_GpuCornerHarrisTest: cvtest::BaseTest
{
float
a
=
dst_gold
.
at
<
float
>
(
i
,
j
);
float
b
=
dsth
.
at
<
float
>
(
i
,
j
);
if
(
fabs
(
a
-
b
)
>
1e-3
f
)
if
(
fabs
(
a
-
b
)
>
1e-3
f
)
{
ts
->
printf
(
cvtest
::
TS
::
CONSOLE
,
"%d %d %f %f %d
\n
"
,
i
,
j
,
a
,
b
,
apertureSize
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
...
...
@@ -674,7 +674,7 @@ struct CV_GpuCornerHarrisTest: cvtest::BaseTest
////////////////////////////////////////////////////////////////////////
// Corner Min Eigen Val
struct
CV_GpuCornerMinEigenValTest
:
cvtest
::
BaseTest
struct
CV_GpuCornerMinEigenValTest
:
cvtest
::
BaseTest
{
CV_GpuCornerMinEigenValTest
()
{}
...
...
@@ -694,7 +694,7 @@ struct CV_GpuCornerMinEigenValTest: cvtest::BaseTest
{
RNG
rng
;
cv
::
Mat
src
(
rows
,
cols
,
depth
);
if
(
depth
==
CV_32F
)
if
(
depth
==
CV_32F
)
rng
.
fill
(
src
,
RNG
::
UNIFORM
,
cv
::
Scalar
(
0
),
cv
::
Scalar
(
1
));
else
if
(
depth
==
CV_8U
)
rng
.
fill
(
src
,
RNG
::
UNIFORM
,
cv
::
Scalar
(
0
),
cv
::
Scalar
(
256
));
...
...
@@ -706,8 +706,8 @@ struct CV_GpuCornerMinEigenValTest: cvtest::BaseTest
int
borderType
;
borderType
=
BORDER_REFLECT101
;
cv
::
cornerMinEigenVal
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
borderType
);
cv
::
gpu
::
cornerMinEigenVal
(
cv
::
gpu
::
GpuMat
(
src
),
dst
,
blockSize
,
apertureSize
,
borderType
);
cv
::
cornerMinEigenVal
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
borderType
);
cv
::
gpu
::
cornerMinEigenVal
(
cv
::
gpu
::
GpuMat
(
src
),
dst
,
blockSize
,
apertureSize
,
borderType
);
dsth
=
dst
;
for
(
int
i
=
0
;
i
<
dst
.
rows
;
++
i
)
...
...
@@ -716,7 +716,7 @@ struct CV_GpuCornerMinEigenValTest: cvtest::BaseTest
{
float
a
=
dst_gold
.
at
<
float
>
(
i
,
j
);
float
b
=
dsth
.
at
<
float
>
(
i
,
j
);
if
(
fabs
(
a
-
b
)
>
1e-2
f
)
if
(
fabs
(
a
-
b
)
>
1e-2
f
)
{
ts
->
printf
(
cvtest
::
TS
::
CONSOLE
,
"%d %d %f %f %d %d
\n
"
,
i
,
j
,
a
,
b
,
apertureSize
,
blockSize
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
...
...
@@ -726,8 +726,8 @@ struct CV_GpuCornerMinEigenValTest: cvtest::BaseTest
}
borderType
=
BORDER_REPLICATE
;
cv
::
cornerMinEigenVal
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
borderType
);
cv
::
gpu
::
cornerMinEigenVal
(
cv
::
gpu
::
GpuMat
(
src
),
dst
,
blockSize
,
apertureSize
,
borderType
);
cv
::
cornerMinEigenVal
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
borderType
);
cv
::
gpu
::
cornerMinEigenVal
(
cv
::
gpu
::
GpuMat
(
src
),
dst
,
blockSize
,
apertureSize
,
borderType
);
dsth
=
dst
;
for
(
int
i
=
0
;
i
<
dst
.
rows
;
++
i
)
...
...
@@ -736,7 +736,7 @@ struct CV_GpuCornerMinEigenValTest: cvtest::BaseTest
{
float
a
=
dst_gold
.
at
<
float
>
(
i
,
j
);
float
b
=
dsth
.
at
<
float
>
(
i
,
j
);
if
(
fabs
(
a
-
b
)
>
1e-2
f
)
if
(
fabs
(
a
-
b
)
>
1e-2
f
)
{
ts
->
printf
(
cvtest
::
TS
::
CONSOLE
,
"%d %d %f %f %d %d
\n
"
,
i
,
j
,
a
,
b
,
apertureSize
,
blockSize
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
...
...
@@ -749,7 +749,7 @@ struct CV_GpuCornerMinEigenValTest: cvtest::BaseTest
}
};
struct
CV_GpuColumnSumTest
:
cvtest
::
BaseTest
struct
CV_GpuColumnSumTest
:
cvtest
::
BaseTest
{
CV_GpuColumnSumTest
()
{}
...
...
@@ -794,7 +794,7 @@ struct CV_GpuColumnSumTest: cvtest::BaseTest
}
};
struct
CV_GpuNormTest
:
cvtest
::
BaseTest
struct
CV_GpuNormTest
:
cvtest
::
BaseTest
{
CV_GpuNormTest
()
{}
...
...
@@ -924,12 +924,12 @@ TEST(downsample, accuracy_on_8U)
for
(
int
k
=
2
;
k
<=
5
;
++
k
)
{
GpuMat
d_dst
;
downsample
(
GpuMat
(
src
),
d_dst
,
k
);
downsample
(
GpuMat
(
src
),
d_dst
,
k
);
Size
dst_gold_size
((
src
.
cols
+
k
-
1
)
/
k
,
(
src
.
rows
+
k
-
1
)
/
k
);
ASSERT_EQ
(
dst_gold_size
.
width
,
d_dst
.
cols
)
ASSERT_EQ
(
dst_gold_size
.
width
,
d_dst
.
cols
)
<<
"rows="
<<
size
.
height
<<
", cols="
<<
size
.
width
<<
", k="
<<
k
;
ASSERT_EQ
(
dst_gold_size
.
height
,
d_dst
.
rows
)
ASSERT_EQ
(
dst_gold_size
.
height
,
d_dst
.
rows
)
<<
"rows="
<<
size
.
height
<<
", cols="
<<
size
.
width
<<
", k="
<<
k
;
Mat
dst
=
d_dst
;
...
...
@@ -949,12 +949,12 @@ TEST(downsample, accuracy_on_32F)
for
(
int
k
=
2
;
k
<=
5
;
++
k
)
{
GpuMat
d_dst
;
downsample
(
GpuMat
(
src
),
d_dst
,
k
);
downsample
(
GpuMat
(
src
),
d_dst
,
k
);
Size
dst_gold_size
((
src
.
cols
+
k
-
1
)
/
k
,
(
src
.
rows
+
k
-
1
)
/
k
);
ASSERT_EQ
(
dst_gold_size
.
width
,
d_dst
.
cols
)
ASSERT_EQ
(
dst_gold_size
.
width
,
d_dst
.
cols
)
<<
"rows="
<<
size
.
height
<<
", cols="
<<
size
.
width
<<
", k="
<<
k
;
ASSERT_EQ
(
dst_gold_size
.
height
,
d_dst
.
rows
)
ASSERT_EQ
(
dst_gold_size
.
height
,
d_dst
.
rows
)
<<
"rows="
<<
size
.
height
<<
", cols="
<<
size
.
width
<<
", k="
<<
k
;
Mat
dst
=
d_dst
;
...
...
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