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
32683ee6
Commit
32683ee6
authored
Jul 21, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9208 from alalek:ipp_minmaxidx
parents
9313978f
544eb4be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
3 deletions
+85
-3
stat.cpp
modules/core/src/stat.cpp
+11
-3
test_arithm.cpp
modules/core/test/test_arithm.cpp
+74
-0
No files found.
modules/core/src/stat.cpp
View file @
32683ee6
...
...
@@ -2530,6 +2530,12 @@ static bool ipp_minMaxIdx(Mat &src, double* _minVal, double* _maxVal, int* _minI
return
false
;
#endif
// cv::minMaxIdx problem with index positions on AVX
#if IPP_VERSION_X100 < 201810
if
(
!
mask
.
empty
()
&&
_maxIdx
&&
ipp
::
getIppFeatures
()
&
ippCPUID_AVX
)
return
false
;
#endif
IppStatus
status
;
IppDataType
dataType
=
ippiGetDataType
(
src
.
depth
());
float
minVal
=
0
;
...
...
@@ -2561,7 +2567,7 @@ static bool ipp_minMaxIdx(Mat &src, double* _minVal, double* _maxVal, int* _minI
size
.
width
*=
src
.
channels
();
status
=
ippMinMaxFun
(
src
.
ptr
(),
(
int
)
src
.
step
,
size
,
dataType
,
pMinVal
,
pMaxVal
,
pMinIdx
,
pMaxIdx
,
(
Ipp8u
*
)
mask
.
ptr
(),
(
int
)
mask
.
step
);
if
(
status
<
0
||
status
==
ippStsNoOperation
)
if
(
status
<
0
)
return
false
;
if
(
_minVal
)
*
_minVal
=
minVal
;
...
...
@@ -2569,7 +2575,8 @@ static bool ipp_minMaxIdx(Mat &src, double* _minVal, double* _maxVal, int* _minI
*
_maxVal
=
maxVal
;
if
(
_minIdx
)
{
if
(
!
mask
.
empty
()
&&
!
minIdx
.
y
&&
!
minIdx
.
x
)
// Should be just ippStsNoOperation check, but there is a bug in the function so we need additional checks
if
(
status
==
ippStsNoOperation
&&
!
mask
.
empty
()
&&
!
pMinIdx
->
x
&&
!
pMinIdx
->
y
)
{
_minIdx
[
0
]
=
-
1
;
_minIdx
[
1
]
=
-
1
;
...
...
@@ -2582,7 +2589,8 @@ static bool ipp_minMaxIdx(Mat &src, double* _minVal, double* _maxVal, int* _minI
}
if
(
_maxIdx
)
{
if
(
!
mask
.
empty
()
&&
!
maxIdx
.
y
&&
!
maxIdx
.
x
)
// Should be just ippStsNoOperation check, but there is a bug in the function so we need additional checks
if
(
status
==
ippStsNoOperation
&&
!
mask
.
empty
()
&&
!
pMaxIdx
->
x
&&
!
pMaxIdx
->
y
)
{
_maxIdx
[
0
]
=
-
1
;
_maxIdx
[
1
]
=
-
1
;
...
...
modules/core/test/test_arithm.cpp
View file @
32683ee6
...
...
@@ -1932,3 +1932,77 @@ TEST(Compare, regression_8999)
compare
(
A
,
B
,
C
,
CMP_LT
);
});
}
TEST
(
Core_minMaxIdx
,
regression_9207_1
)
{
const
int
rows
=
4
;
const
int
cols
=
3
;
uchar
mask_
[
rows
*
cols
]
=
{
255
,
255
,
255
,
255
,
0
,
255
,
0
,
255
,
255
,
0
,
0
,
255
};
uchar
src_
[
rows
*
cols
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
2
,
2
,
1
};
Mat
mask
(
Size
(
cols
,
rows
),
CV_8UC1
,
mask_
);
Mat
src
(
Size
(
cols
,
rows
),
CV_8UC1
,
src_
);
double
minVal
=
-
0.0
,
maxVal
=
-
0.0
;
int
minIdx
[
2
]
=
{
-
2
,
-
2
},
maxIdx
[
2
]
=
{
-
2
,
-
2
};
minMaxIdx
(
src
,
&
minVal
,
&
maxVal
,
minIdx
,
maxIdx
,
mask
);
EXPECT_EQ
(
0
,
minIdx
[
0
]);
EXPECT_EQ
(
0
,
minIdx
[
1
]);
EXPECT_EQ
(
0
,
maxIdx
[
0
]);
EXPECT_EQ
(
0
,
maxIdx
[
1
]);
}
TEST
(
Core_minMaxIdx
,
regression_9207_2
)
{
const
int
rows
=
13
;
const
int
cols
=
15
;
uchar
mask_
[
rows
*
cols
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
0
,
255
,
255
,
255
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
255
,
0
,
0
,
0
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
255
,
0
,
0
,
0
,
0
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
255
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
255
,
0
,
0
,
255
,
255
,
255
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
255
,
255
,
0
,
255
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
255
,
0
,
0
,
0
,
255
,
255
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
0
,
255
,
0
,
0
,
0
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
0
,
0
,
0
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
255
,
255
,
255
,
0
,
0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&
maxVal
,
minIdx
,
maxIdx
,
mask
);
EXPECT_EQ
(
0
,
minIdx
[
0
]);
EXPECT_EQ
(
14
,
minIdx
[
1
]);
EXPECT_EQ
(
0
,
maxIdx
[
0
]);
EXPECT_EQ
(
14
,
maxIdx
[
1
]);
}
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