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
69303258
Commit
69303258
authored
May 17, 2016
by
atinfinity
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test case of cv::threshold(CV_64F)
parent
e4f207c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
9 deletions
+53
-9
test_thresh.cpp
modules/imgproc/test/test_thresh.cpp
+53
-9
No files found.
modules/imgproc/test/test_thresh.cpp
View file @
69303258
...
...
@@ -56,8 +56,8 @@ protected:
void
prepare_to_validation
(
int
);
int
thresh_type
;
float
thresh_val
;
float
max_val
;
double
thresh_val
;
double
max_val
;
};
...
...
@@ -120,7 +120,7 @@ void CV_ThreshTest::run_func()
static
void
test_threshold
(
const
Mat
&
_src
,
Mat
&
_dst
,
float
thresh
,
float
maxval
,
int
thresh_type
)
double
thresh
,
double
maxval
,
int
thresh_type
)
{
int
i
,
j
;
int
depth
=
_src
.
depth
(),
cn
=
_src
.
channels
();
...
...
@@ -144,7 +144,7 @@ static void test_threshold( const Mat& _src, Mat& _dst,
imaxval
=
cvRound
(
maxval
);
}
assert
(
depth
==
CV_8U
||
depth
==
CV_16S
||
depth
==
CV_32F
);
assert
(
depth
==
CV_8U
||
depth
==
CV_16S
||
depth
==
CV_32F
||
depth
==
CV_64F
);
switch
(
thresh_type
)
{
...
...
@@ -165,13 +165,20 @@ static void test_threshold( const Mat& _src, Mat& _dst,
for
(
j
=
0
;
j
<
width_n
;
j
++
)
dst
[
j
]
=
(
short
)(
src
[
j
]
>
ithresh
?
imaxval
:
0
);
}
else
else
if
(
depth
==
CV_32F
)
{
const
float
*
src
=
_src
.
ptr
<
float
>
(
i
);
float
*
dst
=
_dst
.
ptr
<
float
>
(
i
);
for
(
j
=
0
;
j
<
width_n
;
j
++
)
dst
[
j
]
=
src
[
j
]
>
thresh
?
maxval
:
0.
f
;
}
else
{
const
double
*
src
=
_src
.
ptr
<
double
>
(
i
);
double
*
dst
=
_dst
.
ptr
<
double
>
(
i
);
for
(
j
=
0
;
j
<
width_n
;
j
++
)
dst
[
j
]
=
src
[
j
]
>
thresh
?
maxval
:
0.0
;
}
}
break
;
case
CV_THRESH_BINARY_INV
:
...
...
@@ -191,13 +198,20 @@ static void test_threshold( const Mat& _src, Mat& _dst,
for
(
j
=
0
;
j
<
width_n
;
j
++
)
dst
[
j
]
=
(
short
)(
src
[
j
]
>
ithresh
?
0
:
imaxval
);
}
else
else
if
(
depth
==
CV_32F
)
{
const
float
*
src
=
_src
.
ptr
<
float
>
(
i
);
float
*
dst
=
_dst
.
ptr
<
float
>
(
i
);
for
(
j
=
0
;
j
<
width_n
;
j
++
)
dst
[
j
]
=
src
[
j
]
>
thresh
?
0.
f
:
maxval
;
}
else
{
const
double
*
src
=
_src
.
ptr
<
double
>
(
i
);
double
*
dst
=
_dst
.
ptr
<
double
>
(
i
);
for
(
j
=
0
;
j
<
width_n
;
j
++
)
dst
[
j
]
=
src
[
j
]
>
thresh
?
0.0
:
maxval
;
}
}
break
;
case
CV_THRESH_TRUNC
:
...
...
@@ -223,7 +237,7 @@ static void test_threshold( const Mat& _src, Mat& _dst,
dst
[
j
]
=
(
short
)(
s
>
ithresh
?
ithresh2
:
s
);
}
}
else
else
if
(
depth
==
CV_32F
)
{
const
float
*
src
=
_src
.
ptr
<
float
>
(
i
);
float
*
dst
=
_dst
.
ptr
<
float
>
(
i
);
...
...
@@ -233,6 +247,16 @@ static void test_threshold( const Mat& _src, Mat& _dst,
dst
[
j
]
=
s
>
thresh
?
thresh
:
s
;
}
}
else
{
const
double
*
src
=
_src
.
ptr
<
double
>
(
i
);
double
*
dst
=
_dst
.
ptr
<
double
>
(
i
);
for
(
j
=
0
;
j
<
width_n
;
j
++
)
{
double
s
=
src
[
j
];
dst
[
j
]
=
s
>
thresh
?
thresh
:
s
;
}
}
}
break
;
case
CV_THRESH_TOZERO
:
...
...
@@ -258,7 +282,7 @@ static void test_threshold( const Mat& _src, Mat& _dst,
dst
[
j
]
=
(
short
)(
s
>
ithresh
?
s
:
0
);
}
}
else
else
if
(
depth
==
CV_32F
)
{
const
float
*
src
=
_src
.
ptr
<
float
>
(
i
);
float
*
dst
=
_dst
.
ptr
<
float
>
(
i
);
...
...
@@ -268,6 +292,16 @@ static void test_threshold( const Mat& _src, Mat& _dst,
dst
[
j
]
=
s
>
thresh
?
s
:
0.
f
;
}
}
else
{
const
double
*
src
=
_src
.
ptr
<
double
>
(
i
);
double
*
dst
=
_dst
.
ptr
<
double
>
(
i
);
for
(
j
=
0
;
j
<
width_n
;
j
++
)
{
double
s
=
src
[
j
];
dst
[
j
]
=
s
>
thresh
?
s
:
0.0
;
}
}
}
break
;
case
CV_THRESH_TOZERO_INV
:
...
...
@@ -293,7 +327,7 @@ static void test_threshold( const Mat& _src, Mat& _dst,
dst
[
j
]
=
(
short
)(
s
>
ithresh
?
0
:
s
);
}
}
else
else
if
(
depth
==
CV_32F
)
{
const
float
*
src
=
_src
.
ptr
<
float
>
(
i
);
float
*
dst
=
_dst
.
ptr
<
float
>
(
i
);
...
...
@@ -303,6 +337,16 @@ static void test_threshold( const Mat& _src, Mat& _dst,
dst
[
j
]
=
s
>
thresh
?
0.
f
:
s
;
}
}
else
{
const
double
*
src
=
_src
.
ptr
<
double
>
(
i
);
double
*
dst
=
_dst
.
ptr
<
double
>
(
i
);
for
(
j
=
0
;
j
<
width_n
;
j
++
)
{
double
s
=
src
[
j
];
dst
[
j
]
=
s
>
thresh
?
0.0
:
s
;
}
}
}
break
;
default
:
...
...
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