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
13d18d65
Commit
13d18d65
authored
Nov 24, 2010
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support of multichannel matrices in gpu::minMax
parent
282e01cb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
19 deletions
+21
-19
arithm.cpp
modules/gpu/src/arithm.cpp
+9
-9
arithm.cpp
tests/gpu/src/arithm.cpp
+12
-10
No files found.
modules/gpu/src/arithm.cpp
View file @
13d18d65
...
@@ -496,34 +496,34 @@ namespace cv { namespace gpu { namespace mathfunc {
...
@@ -496,34 +496,34 @@ namespace cv { namespace gpu { namespace mathfunc {
void
cv
::
gpu
::
minMax
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
)
void
cv
::
gpu
::
minMax
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
)
{
{
CV_Assert
(
src
.
channels
()
==
1
);
GpuMat
src_
=
src
.
reshape
(
1
);
double
maxVal_
;
double
maxVal_
;
if
(
!
maxVal
)
if
(
!
maxVal
)
maxVal
=
&
maxVal_
;
maxVal
=
&
maxVal_
;
switch
(
src
.
type
())
switch
(
src
_
.
type
())
{
{
case
CV_8U
:
case
CV_8U
:
mathfunc
::
min_max_caller
<
unsigned
char
>
(
src
,
minVal
,
maxVal
);
mathfunc
::
min_max_caller
<
unsigned
char
>
(
src
_
,
minVal
,
maxVal
);
break
;
break
;
case
CV_8S
:
case
CV_8S
:
mathfunc
::
min_max_caller
<
signed
char
>
(
src
,
minVal
,
maxVal
);
mathfunc
::
min_max_caller
<
signed
char
>
(
src
_
,
minVal
,
maxVal
);
break
;
break
;
case
CV_16U
:
case
CV_16U
:
mathfunc
::
min_max_caller
<
unsigned
short
>
(
src
,
minVal
,
maxVal
);
mathfunc
::
min_max_caller
<
unsigned
short
>
(
src
_
,
minVal
,
maxVal
);
break
;
break
;
case
CV_16S
:
case
CV_16S
:
mathfunc
::
min_max_caller
<
signed
short
>
(
src
,
minVal
,
maxVal
);
mathfunc
::
min_max_caller
<
signed
short
>
(
src
_
,
minVal
,
maxVal
);
break
;
break
;
case
CV_32S
:
case
CV_32S
:
mathfunc
::
min_max_caller
<
int
>
(
src
,
minVal
,
maxVal
);
mathfunc
::
min_max_caller
<
int
>
(
src
_
,
minVal
,
maxVal
);
break
;
break
;
case
CV_32F
:
case
CV_32F
:
mathfunc
::
min_max_caller
<
float
>
(
src
,
minVal
,
maxVal
);
mathfunc
::
min_max_caller
<
float
>
(
src
_
,
minVal
,
maxVal
);
break
;
break
;
case
CV_64F
:
case
CV_64F
:
mathfunc
::
min_max_caller
<
double
>
(
src
,
minVal
,
maxVal
);
mathfunc
::
min_max_caller
<
double
>
(
src
_
,
minVal
,
maxVal
);
break
;
break
;
default
:
default
:
CV_Error
(
CV_StsBadArg
,
"Unsupported type"
);
CV_Error
(
CV_StsBadArg
,
"Unsupported type"
);
...
...
tests/gpu/src/arithm.cpp
View file @
13d18d65
...
@@ -678,22 +678,23 @@ struct CV_GpuMinMaxTest: public CvTest
...
@@ -678,22 +678,23 @@ struct CV_GpuMinMaxTest: public CvTest
void
run
(
int
)
void
run
(
int
)
{
{
for
(
int
type
=
CV_8U
;
type
<=
CV_64F
;
++
type
)
for
(
int
cn
=
1
;
cn
<=
4
;
++
cn
)
for
(
int
depth
=
CV_8U
;
depth
<=
CV_64F
;
++
depth
)
{
{
int
rows
=
1
,
cols
=
3
;
int
rows
=
1
,
cols
=
3
;
test
(
rows
,
cols
,
type
);
test
(
rows
,
cols
,
cn
,
depth
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
{
int
rows
=
1
+
rand
()
%
1000
;
int
rows
=
1
+
rand
()
%
1000
;
int
cols
=
1
+
rand
()
%
1000
;
int
cols
=
1
+
rand
()
%
1000
;
test
(
rows
,
cols
,
type
);
test
(
rows
,
cols
,
cn
,
depth
);
}
}
}
}
}
}
void
test
(
int
rows
,
int
cols
,
int
type
)
void
test
(
int
rows
,
int
cols
,
int
cn
,
int
depth
)
{
{
cv
::
Mat
src
(
rows
,
cols
,
type
);
cv
::
Mat
src
(
rows
,
cols
,
CV_MAKE_TYPE
(
depth
,
cn
)
);
cv
::
RNG
rng
;
cv
::
RNG
rng
;
for
(
int
i
=
0
;
i
<
src
.
rows
;
++
i
)
for
(
int
i
=
0
;
i
<
src
.
rows
;
++
i
)
{
{
...
@@ -702,20 +703,21 @@ struct CV_GpuMinMaxTest: public CvTest
...
@@ -702,20 +703,21 @@ struct CV_GpuMinMaxTest: public CvTest
}
}
double
minVal
,
maxVal
;
double
minVal
,
maxVal
;
if
(
type
!=
CV_8S
)
Mat
src_
=
src
.
reshape
(
1
);
if
(
depth
!=
CV_8S
)
{
{
cv
::
Point
minLoc
,
maxLoc
;
cv
::
Point
minLoc
,
maxLoc
;
cv
::
minMaxLoc
(
src
,
&
minVal
,
&
maxVal
,
&
minLoc
,
&
maxLoc
);
cv
::
minMaxLoc
(
src
_
,
&
minVal
,
&
maxVal
,
&
minLoc
,
&
maxLoc
);
}
}
else
else
{
{
// OpenCV's minMaxLoc doesn't support CV_8S type
// OpenCV's minMaxLoc doesn't support CV_8S type
minVal
=
std
::
numeric_limits
<
double
>::
max
();
minVal
=
std
::
numeric_limits
<
double
>::
max
();
maxVal
=
std
::
numeric_limits
<
double
>::
min
();
maxVal
=
std
::
numeric_limits
<
double
>::
min
();
for
(
int
i
=
0
;
i
<
src
.
rows
;
++
i
)
for
(
int
i
=
0
;
i
<
src
_
.
rows
;
++
i
)
for
(
int
j
=
0
;
j
<
src
.
cols
;
++
j
)
for
(
int
j
=
0
;
j
<
src
_
.
cols
;
++
j
)
{
{
char
val
=
src
.
at
<
char
>
(
i
,
j
);
char
val
=
src
_
.
at
<
char
>
(
i
,
j
);
if
(
val
<
minVal
)
minVal
=
val
;
if
(
val
<
minVal
)
minVal
=
val
;
if
(
val
>
maxVal
)
maxVal
=
val
;
if
(
val
>
maxVal
)
maxVal
=
val
;
}
}
...
...
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