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
f4f15617
Commit
f4f15617
authored
Feb 26, 2016
by
aravind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed cv::cuda::reduce bug.
parent
81f21e6e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
19 deletions
+6
-19
perf_reductions.cpp
modules/cudaarithm/perf/perf_reductions.cpp
+2
-0
reduce.cu
modules/cudaarithm/src/cuda/reduce.cu
+1
-1
test_reductions.cpp
modules/cudaarithm/test/test_reductions.cpp
+1
-4
reduce_to_vec.hpp
modules/cudev/include/opencv2/cudev/grid/reduce_to_vec.hpp
+2
-2
test_reduction.cu
modules/cudev/test/test_reduction.cu
+0
-12
No files found.
modules/cudaarithm/perf/perf_reductions.cpp
View file @
f4f15617
...
...
@@ -368,6 +368,8 @@ PERF_TEST_P(Sz_Depth_Cn_Code_Dim, Reduce,
TEST_CYCLE
()
cv
::
cuda
::
reduce
(
d_src
,
dst
,
dim
,
reduceOp
,
CV_32F
);
dst
=
dst
.
reshape
(
dst
.
channels
(),
1
);
CUDA_SANITY_CHECK
(
dst
);
}
else
...
...
modules/cudaarithm/src/cuda/reduce.cu
View file @
f4f15617
...
...
@@ -137,7 +137,7 @@ void cv::cuda::reduce(InputArray _src, OutputArray _dst, int dim, int reduceOp,
if (dtype < 0)
dtype = src.depth();
GpuMat dst = getOutputMat(_dst,
1, dim == 0 ? src.cols : src.rows
, CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()), stream);
GpuMat dst = getOutputMat(_dst,
dim == 0 ? 1 : src.rows, dim == 0 ? src.cols : 1
, CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()), stream);
if (dim == 0)
{
...
...
modules/cudaarithm/test/test_reductions.cpp
View file @
f4f15617
...
...
@@ -877,14 +877,11 @@ CUDA_TEST_P(Reduce, Cols)
{
cv
::
Mat
src
=
randomMat
(
size
,
type
);
cv
::
cuda
::
GpuMat
dst
=
createMat
(
cv
::
Size
(
src
.
rows
,
1
),
dst_type
,
useRoi
)
;
cv
::
cuda
::
GpuMat
dst
;
cv
::
cuda
::
reduce
(
loadMat
(
src
,
useRoi
),
dst
,
1
,
reduceOp
,
dst_depth
);
cv
::
Mat
dst_gold
;
cv
::
reduce
(
src
,
dst_gold
,
1
,
reduceOp
,
dst_depth
);
dst_gold
.
cols
=
dst_gold
.
rows
;
dst_gold
.
rows
=
1
;
dst_gold
.
step
=
dst_gold
.
cols
*
dst_gold
.
elemSize
();
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
dst_depth
<
CV_32F
?
0.0
:
0.02
);
}
...
...
modules/cudev/include/opencv2/cudev/grid/reduce_to_vec.hpp
View file @
f4f15617
...
...
@@ -182,7 +182,7 @@ __host__ void gridReduceToColumn_(const SrcPtr& src, GpuMat_<ResType>& dst, cons
CV_Assert
(
getRows
(
mask
)
==
rows
&&
getCols
(
mask
)
==
cols
);
dst
.
create
(
1
,
rows
);
cuda
::
createContinuous
(
rows
,
1
,
dst
.
type
(),
dst
);
grid_reduce_to_vec_detail
::
reduceToColumn
<
Reductor
,
Policy
>
(
shrinkPtr
(
src
),
dst
[
0
],
...
...
@@ -197,7 +197,7 @@ __host__ void gridReduceToColumn_(const SrcPtr& src, GpuMat_<ResType>& dst, Stre
const
int
rows
=
getRows
(
src
);
const
int
cols
=
getCols
(
src
);
dst
.
create
(
1
,
rows
);
cuda
::
createContinuous
(
rows
,
1
,
dst
.
type
(),
dst
);
grid_reduce_to_vec_detail
::
reduceToColumn
<
Reductor
,
Policy
>
(
shrinkPtr
(
src
),
dst
[
0
],
...
...
modules/cudev/test/test_reduction.cu
View file @
f4f15617
...
...
@@ -228,9 +228,6 @@ TEST(ReduceToColumn, Sum)
Mat dst_gold;
cv::reduce(src, dst_gold, 1, REDUCE_SUM, CV_32S);
dst_gold.cols = dst_gold.rows;
dst_gold.rows = 1;
dst_gold.step = dst_gold.cols * dst_gold.elemSize();
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
}
...
...
@@ -247,9 +244,6 @@ TEST(ReduceToColumn, Avg)
Mat dst_gold;
cv::reduce(src, dst_gold, 1, REDUCE_AVG, CV_32F);
dst_gold.cols = dst_gold.rows;
dst_gold.rows = 1;
dst_gold.step = dst_gold.cols * dst_gold.elemSize();
EXPECT_MAT_NEAR(dst_gold, dst, 1e-4);
}
...
...
@@ -266,9 +260,6 @@ TEST(ReduceToColumn, Min)
Mat dst_gold;
cv::reduce(src, dst_gold, 1, REDUCE_MIN);
dst_gold.cols = dst_gold.rows;
dst_gold.rows = 1;
dst_gold.step = dst_gold.cols * dst_gold.elemSize();
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
}
...
...
@@ -285,9 +276,6 @@ TEST(ReduceToColumn, Max)
Mat dst_gold;
cv::reduce(src, dst_gold, 1, REDUCE_MAX);
dst_gold.cols = dst_gold.rows;
dst_gold.rows = 1;
dst_gold.step = dst_gold.cols * dst_gold.elemSize();
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
}
...
...
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