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
7ae547a2
Commit
7ae547a2
authored
Apr 11, 2014
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Apr 11, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2597 from ilya-lavrenov:ipp_countnonzero
parents
b56dce39
b2379b51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
stat.cpp
modules/core/src/stat.cpp
+28
-2
No files found.
modules/core/src/stat.cpp
View file @
7ae547a2
...
...
@@ -680,7 +680,8 @@ static bool ocl_countNonZero( InputArray _src, int & res )
int
cv
::
countNonZero
(
InputArray
_src
)
{
CV_Assert
(
_src
.
channels
()
==
1
);
int
type
=
_src
.
type
(),
cn
=
CV_MAT_CN
(
type
);
CV_Assert
(
cn
==
1
);
#ifdef HAVE_OPENCL
int
res
=
-
1
;
...
...
@@ -690,8 +691,33 @@ int cv::countNonZero( InputArray _src )
#endif
Mat
src
=
_src
.
getMat
();
CountNonZeroFunc
func
=
getCountNonZeroTab
(
src
.
depth
());
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
if
(
src
.
dims
<=
2
||
src
.
isContinuous
())
{
IppiSize
roiSize
=
{
src
.
cols
,
src
.
rows
};
Ipp32s
count
,
srcstep
=
(
Ipp32s
)
src
.
step
;
IppStatus
status
=
(
IppStatus
)
-
1
;
if
(
src
.
isContinuous
())
{
roiSize
.
width
=
(
Ipp32s
)
src
.
total
();
roiSize
.
height
=
1
;
srcstep
=
(
Ipp32s
)
src
.
total
()
*
CV_ELEM_SIZE
(
type
);
}
int
depth
=
CV_MAT_DEPTH
(
type
);
if
(
depth
==
CV_8U
)
status
=
ippiCountInRange_8u_C1R
((
const
Ipp8u
*
)
src
.
data
,
srcstep
,
roiSize
,
&
count
,
0
,
0
);
else
if
(
depth
==
CV_32F
)
status
=
ippiCountInRange_32f_C1R
((
const
Ipp32f
*
)
src
.
data
,
srcstep
,
roiSize
,
&
count
,
0
,
0
);
if
(
status
>=
0
)
return
(
Ipp32s
)
src
.
total
()
-
count
;
}
#endif
CountNonZeroFunc
func
=
getCountNonZeroTab
(
src
.
depth
());
CV_Assert
(
func
!=
0
);
const
Mat
*
arrays
[]
=
{
&
src
,
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