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
1d321974
Commit
1d321974
authored
Mar 11, 2013
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Mar 11, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #633 from jet47:gpu-debayer-gray
parents
632211eb
4ddf634c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
5 deletions
+111
-5
perf_imgproc.cpp
modules/gpu/perf/perf_imgproc.cpp
+6
-1
color.cpp
modules/gpu/src/color.cpp
+41
-4
debayer.cu
modules/gpu/src/cuda/debayer.cu
+0
-0
test_color.cpp
modules/gpu/test/test_color.cpp
+64
-0
No files found.
modules/gpu/perf/perf_imgproc.cpp
View file @
1d321974
...
...
@@ -1341,7 +1341,12 @@ PERF_TEST_P(Sz_Depth_Code, ImgProc_CvtColorBayer,
Values
(
CvtColorInfo
(
1
,
3
,
cv
::
COLOR_BayerBG2BGR
),
CvtColorInfo
(
1
,
3
,
cv
::
COLOR_BayerGB2BGR
),
CvtColorInfo
(
1
,
3
,
cv
::
COLOR_BayerRG2BGR
),
CvtColorInfo
(
1
,
3
,
cv
::
COLOR_BayerGR2BGR
))))
CvtColorInfo
(
1
,
3
,
cv
::
COLOR_BayerGR2BGR
),
CvtColorInfo
(
1
,
1
,
cv
::
COLOR_BayerBG2GRAY
),
CvtColorInfo
(
1
,
1
,
cv
::
COLOR_BayerGB2GRAY
),
CvtColorInfo
(
1
,
1
,
cv
::
COLOR_BayerRG2GRAY
),
CvtColorInfo
(
1
,
1
,
cv
::
COLOR_BayerGR2GRAY
))))
{
const
cv
::
Size
size
=
GET_PARAM
(
0
);
const
int
depth
=
GET_PARAM
(
1
);
...
...
modules/gpu/src/color.cpp
View file @
1d321974
...
...
@@ -1640,6 +1640,43 @@ namespace
{
bayer_to_bgr
(
src
,
dst
,
dcn
,
true
,
true
,
stream
);
}
void
bayer_to_gray
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
bool
blue_last
,
bool
start_with_green
,
Stream
&
stream
)
{
typedef
void
(
*
func_t
)(
PtrStepSzb
src
,
PtrStepSzb
dst
,
bool
blue_last
,
bool
start_with_green
,
cudaStream_t
stream
);
static
const
func_t
funcs
[
3
]
=
{
Bayer2BGR_8u_gpu
<
1
>
,
0
,
Bayer2BGR_16u_gpu
<
1
>
,
};
CV_Assert
(
src
.
type
()
==
CV_8UC1
||
src
.
type
()
==
CV_16UC1
);
CV_Assert
(
src
.
rows
>
2
&&
src
.
cols
>
2
);
dst
.
create
(
src
.
size
(),
CV_MAKETYPE
(
src
.
depth
(),
1
));
funcs
[
src
.
depth
()](
src
,
dst
,
blue_last
,
start_with_green
,
StreamAccessor
::
getStream
(
stream
));
}
void
bayerBG_to_gray
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
/*dcn*/
,
Stream
&
stream
)
{
bayer_to_gray
(
src
,
dst
,
false
,
false
,
stream
);
}
void
bayerGB_to_gray
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
/*dcn*/
,
Stream
&
stream
)
{
bayer_to_gray
(
src
,
dst
,
false
,
true
,
stream
);
}
void
bayerRG_to_gray
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
/*dcn*/
,
Stream
&
stream
)
{
bayer_to_gray
(
src
,
dst
,
true
,
false
,
stream
);
}
void
bayerGR_to_gray
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
/*dcn*/
,
Stream
&
stream
)
{
bayer_to_gray
(
src
,
dst
,
true
,
true
,
stream
);
}
}
void
cv
::
gpu
::
cvtColor
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
,
Stream
&
stream
)
...
...
@@ -1756,10 +1793,10 @@ void cv::gpu::cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn, Stream
yuv_to_bgr
,
// CV_YUV2BGR = 84
yuv_to_rgb
,
// CV_YUV2RGB = 85
0
,
// CV_BayerBG2GRAY = 86
0
,
// CV_BayerGB2GRAY = 87
0
,
// CV_BayerRG2GRAY = 88
0
,
// CV_BayerGR2GRAY = 89
bayerBG_to_gray
,
// CV_BayerBG2GRAY = 86
bayerGB_to_gray
,
// CV_BayerGB2GRAY = 87
bayerRG_to_gray
,
// CV_BayerRG2GRAY = 88
bayerGR_to_gray
,
// CV_BayerGR2GRAY = 89
//YUV 4:2:0 formats family
0
,
// CV_YUV2RGB_NV12 = 90,
...
...
modules/gpu/src/cuda/debayer.cu
View file @
1d321974
This diff is collapsed.
Click to expand it.
modules/gpu/test/test_color.cpp
View file @
1d321974
...
...
@@ -2218,6 +2218,70 @@ GPU_TEST_P(CvtColor, BayerGR2BGR4)
EXPECT_MAT_NEAR
(
dst_gold
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
dst3
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
0
);
}
GPU_TEST_P
(
CvtColor
,
BayerBG2Gray
)
{
if
((
depth
!=
CV_8U
&&
depth
!=
CV_16U
)
||
useRoi
)
return
;
cv
::
Mat
src
=
randomMat
(
size
,
depth
);
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
cvtColor
(
loadMat
(
src
,
useRoi
),
dst
,
cv
::
COLOR_BayerBG2GRAY
);
cv
::
Mat
dst_gold
;
cv
::
cvtColor
(
src
,
dst_gold
,
cv
::
COLOR_BayerBG2GRAY
);
EXPECT_MAT_NEAR
(
dst_gold
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
dst
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
2
);
}
GPU_TEST_P
(
CvtColor
,
BayerGB2Gray
)
{
if
((
depth
!=
CV_8U
&&
depth
!=
CV_16U
)
||
useRoi
)
return
;
cv
::
Mat
src
=
randomMat
(
size
,
depth
);
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
cvtColor
(
loadMat
(
src
,
useRoi
),
dst
,
cv
::
COLOR_BayerGB2GRAY
);
cv
::
Mat
dst_gold
;
cv
::
cvtColor
(
src
,
dst_gold
,
cv
::
COLOR_BayerGB2GRAY
);
EXPECT_MAT_NEAR
(
dst_gold
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
dst
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
2
);
}
GPU_TEST_P
(
CvtColor
,
BayerRG2Gray
)
{
if
((
depth
!=
CV_8U
&&
depth
!=
CV_16U
)
||
useRoi
)
return
;
cv
::
Mat
src
=
randomMat
(
size
,
depth
);
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
cvtColor
(
loadMat
(
src
,
useRoi
),
dst
,
cv
::
COLOR_BayerRG2GRAY
);
cv
::
Mat
dst_gold
;
cv
::
cvtColor
(
src
,
dst_gold
,
cv
::
COLOR_BayerRG2GRAY
);
EXPECT_MAT_NEAR
(
dst_gold
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
dst
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
2
);
}
GPU_TEST_P
(
CvtColor
,
BayerGR2Gray
)
{
if
((
depth
!=
CV_8U
&&
depth
!=
CV_16U
)
||
useRoi
)
return
;
cv
::
Mat
src
=
randomMat
(
size
,
depth
);
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
cvtColor
(
loadMat
(
src
,
useRoi
),
dst
,
cv
::
COLOR_BayerGR2GRAY
);
cv
::
Mat
dst_gold
;
cv
::
cvtColor
(
src
,
dst_gold
,
cv
::
COLOR_BayerGR2GRAY
);
EXPECT_MAT_NEAR
(
dst_gold
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
dst
(
cv
::
Rect
(
1
,
1
,
dst
.
cols
-
2
,
dst
.
rows
-
2
)),
2
);
}
INSTANTIATE_TEST_CASE_P
(
GPU_ImgProc
,
CvtColor
,
testing
::
Combine
(
ALL_DEVICES
,
DIFFERENT_SIZES
,
...
...
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