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
b0fa4776
Commit
b0fa4776
authored
8 years ago
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6908 from ilya-lavrenov:reduce
parents
154d61ed
0af39474
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
core.hpp
modules/core/include/opencv2/core.hpp
+3
-3
test_mat.cpp
modules/core/test/test_mat.cpp
+11
-0
No files found.
modules/core/include/opencv2/core.hpp
View file @
b0fa4776
...
...
@@ -826,9 +826,9 @@ CV_EXPORTS void minMaxLoc(const SparseMat& a, double* minVal,
The function reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of
1D vectors and performing the specified operation on the vectors until a single row/column is
obtained. For example, the function can be used to compute horizontal and vertical projections of a
raster image. In case of REDUCE_
SUM and REDUCE_AVG , the output may have a larger element
bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction
modes.
raster image. In case of REDUCE_
MAX and REDUCE_MIN , the output image should have the same type as the source one.
In case of REDUCE_SUM and REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy.
And multi-channel arrays are also supported in these two reduction
modes.
@param src input 2D matrix.
@param dst output vector. Its size and type is defined by dim and dtype parameters.
@param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to
...
...
This diff is collapsed.
Click to expand it.
modules/core/test/test_mat.cpp
View file @
b0fa4776
...
...
@@ -1509,3 +1509,14 @@ TEST(Mat, regression_6696_BigData_8Gb)
EXPECT_EQ
(
4
,
destImageBGR
.
at
<
Vec4b
>
(
height
-
1
,
width
-
1
)[
3
]);
}
#endif
TEST
(
Reduce
,
regression_should_fail_bug_4594
)
{
cv
::
Mat
src
=
cv
::
Mat
::
eye
(
4
,
4
,
CV_8U
);
std
::
vector
<
int
>
dst
;
EXPECT_THROW
(
cv
::
reduce
(
src
,
dst
,
0
,
CV_REDUCE_MIN
,
CV_32S
),
cv
::
Exception
);
EXPECT_THROW
(
cv
::
reduce
(
src
,
dst
,
0
,
CV_REDUCE_MAX
,
CV_32S
),
cv
::
Exception
);
EXPECT_NO_THROW
(
cv
::
reduce
(
src
,
dst
,
0
,
CV_REDUCE_SUM
,
CV_32S
));
EXPECT_NO_THROW
(
cv
::
reduce
(
src
,
dst
,
0
,
CV_REDUCE_AVG
,
CV_32S
));
}
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