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
971e35f2
Commit
971e35f2
authored
Aug 17, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in gpu::cvtColor
parent
5e9ae6b1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
10 deletions
+31
-10
color.cpp
modules/gpu/src/color.cpp
+0
-0
color.cu
modules/gpu/src/cuda/color.cu
+8
-4
color.hpp
modules/gpu/src/opencv2/gpu/device/detail/color.hpp
+23
-6
test_imgproc.cpp
modules/gpu/test/test_imgproc.cpp
+0
-0
No files found.
modules/gpu/src/color.cpp
View file @
971e35f2
This diff is collapsed.
Click to expand it.
modules/gpu/src/cuda/color.cu
View file @
971e35f2
...
...
@@ -44,11 +44,15 @@
#include "opencv2/gpu/device/transform.hpp"
#include "opencv2/gpu/device/color.hpp"
using namespace cv::gpu;
using namespace cv::gpu::device;
namespace cv { namespace gpu { namespace color
namespace cv { namespace gpu { namespace device
{
template <> struct TransformFunctorTraits<bgra_to_rgba_traits<uchar>::functor_type> : DefaultTransformFunctorTraits<bgra_to_rgba_traits<uchar>::functor_type>
{
enum { smart_block_dim_x = 8 };
enum { smart_block_dim_y = 8 };
enum { smart_shift = 4 };
};
#define OPENCV_GPU_IMPLEMENT_CVTCOLOR(name, traits) \
void name(const DevMem2D& src, const DevMem2D& dst, cudaStream_t stream) \
{ \
...
...
modules/gpu/src/opencv2/gpu/device/detail/color.hpp
View file @
971e35f2
...
...
@@ -100,15 +100,32 @@ namespace cv { namespace gpu { namespace device
namespace
detail
{
template
<
typename
T
,
typename
D
,
int
bidx
>
struct
RGB2RGB
:
public
unary_function
<
T
,
D
>
template
<
typename
T
,
int
scn
,
int
dcn
,
int
bidx
>
struct
RGB2RGB
:
unary_function
<
typename
TypeVec
<
T
,
scn
>::
vec_type
,
typename
TypeVec
<
T
,
dcn
>::
vec_type
>
{
__device__
D
operator
()(
const
T
&
src
)
const
__device__
typename
TypeVec
<
T
,
dcn
>::
vec_type
operator
()(
const
typename
TypeVec
<
T
,
scn
>::
vec_type
&
src
)
const
{
D
dst
;
typename
TypeVec
<
T
,
dcn
>::
vec_type
dst
;
dst
.
x
=
(
&
src
.
x
)[
bidx
];
dst
.
y
=
src
.
y
;
dst
.
z
=
(
&
src
.
x
)[
bidx
^
2
];
setAlpha
(
dst
,
getAlpha
<
typename
VecTraits
<
T
>::
elem_type
>
(
src
));
setAlpha
(
dst
,
getAlpha
<
T
>
(
src
));
return
dst
;
}
};
template
<>
struct
RGB2RGB
<
uchar
,
4
,
4
,
2
>
:
unary_function
<
uint
,
uint
>
{
__device__
uint
operator
()(
uint
src
)
const
{
uint
dst
=
0
;
dst
|=
(
0xff
&
(
src
>>
16
));
dst
|=
(
0xff
&
(
src
>>
8
))
<<
8
;
dst
|=
(
0xff
&
(
src
))
<<
16
;
dst
|=
(
0xff
&
(
src
>>
24
))
<<
24
;
return
dst
;
}
};
...
...
@@ -117,10 +134,10 @@ namespace cv { namespace gpu { namespace device
#define OPENCV_GPU_IMPLEMENT_RGB2RGB_TRAITS(name, scn, dcn, bidx) \
template
<
typename
T
>
struct
name
##
_traits
\
{
\
typedef
detail
::
RGB2RGB
<
typename
TypeVec
<
T
,
scn
>::
vec_type
,
typename
TypeVec
<
T
,
dcn
>::
vec_type
,
bidx
>
functor_type
;
\
typedef
detail
::
RGB2RGB
<
T
,
scn
,
dcn
,
bidx
>
functor_type
;
\
static
__host__
__device__
__forceinline__
functor_type
create_functor
()
\
{
\
return
detail
::
RGB2RGB
<
typename
TypeVec
<
T
,
scn
>::
vec_type
,
typename
TypeVec
<
T
,
dcn
>::
vec_type
,
bidx
>
();
\
return
functor_type
();
\
}
\
};
...
...
modules/gpu/test/test_imgproc.cpp
View file @
971e35f2
This diff is collapsed.
Click to expand it.
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