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
3aedc134
Commit
3aedc134
authored
Dec 09, 2016
by
apavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replacing white noise with fruits picture
parent
a99118c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
test_canny.cpp
modules/imgproc/test/test_canny.cpp
+23
-6
No files found.
modules/imgproc/test/test_canny.cpp
View file @
3aedc134
...
@@ -62,6 +62,8 @@ protected:
...
@@ -62,6 +62,8 @@ protected:
double
threshold1
,
threshold2
;
double
threshold1
,
threshold2
;
bool
test_cpp
;
bool
test_cpp
;
bool
test_custom_deriv
;
bool
test_custom_deriv
;
Mat
img
;
};
};
...
@@ -77,6 +79,9 @@ CV_CannyTest::CV_CannyTest(bool custom_deriv)
...
@@ -77,6 +79,9 @@ CV_CannyTest::CV_CannyTest(bool custom_deriv)
test_cpp
=
false
;
test_cpp
=
false
;
test_custom_deriv
=
custom_deriv
;
test_custom_deriv
=
custom_deriv
;
const
char
imgPath
[]
=
"shared/fruits.png"
;
img
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
imgPath
,
IMREAD_GRAYSCALE
);
}
}
...
@@ -112,8 +117,21 @@ int CV_CannyTest::prepare_test_case( int test_case_idx )
...
@@ -112,8 +117,21 @@ int CV_CannyTest::prepare_test_case( int test_case_idx )
int
code
=
cvtest
::
ArrayTest
::
prepare_test_case
(
test_case_idx
);
int
code
=
cvtest
::
ArrayTest
::
prepare_test_case
(
test_case_idx
);
if
(
code
>
0
)
if
(
code
>
0
)
{
{
RNG
&
rng
=
ts
->
get_rng
();
Mat
&
src
=
test_mat
[
INPUT
][
0
];
Mat
&
src
=
test_mat
[
INPUT
][
0
];
GaussianBlur
(
src
,
src
,
Size
(
11
,
11
),
5
,
5
);
//GaussianBlur(src, src, Size(11, 11), 5, 5);
if
(
src
.
cols
>
img
.
cols
||
src
.
rows
>
img
.
rows
)
resize
(
img
,
src
,
src
.
size
());
else
img
(
Rect
(
cvtest
::
randInt
(
rng
)
%
(
img
.
cols
-
src
.
cols
),
cvtest
::
randInt
(
rng
)
%
(
img
.
rows
-
src
.
rows
),
src
.
cols
,
src
.
rows
)
).
copyTo
(
src
);
GaussianBlur
(
src
,
src
,
Size
(
5
,
5
),
0
);
}
}
return
code
;
return
code
;
...
@@ -302,9 +320,8 @@ int CV_CannyTest::validate_test_results( int test_case_idx )
...
@@ -302,9 +320,8 @@ int CV_CannyTest::validate_test_results( int test_case_idx )
return
code
;
return
code
;
}
}
// disabling, since testing on a white noise seems having too few sense...
TEST
(
Imgproc_Canny
,
accuracy
)
{
CV_CannyTest
test
;
test
.
safe_run
();
}
TEST
(
DISABLED_Imgproc_Canny
,
accuracy
)
{
CV_CannyTest
test
;
test
.
safe_run
();
}
TEST
(
Imgproc_Canny
,
accuracy_deriv
)
{
CV_CannyTest
test
(
true
);
test
.
safe_run
();
}
TEST
(
DISABLED_Imgproc_Canny
,
accuracy_deriv
)
{
CV_CannyTest
test
(
true
);
test
.
safe_run
();
}
/*
/*
...
@@ -366,7 +383,7 @@ TEST_P(CannyVX, Accuracy)
...
@@ -366,7 +383,7 @@ TEST_P(CannyVX, Accuracy)
Mat
cannyVX
;
Mat
cannyVX
;
cv
::
Canny
(
src
,
cannyVX
,
100
,
150
,
3
);
cv
::
Canny
(
src
,
cannyVX
,
100
,
150
,
3
);
setUseOpenVX
(
false
);
// 'smart' diff check (excluding isolated pixels)
Mat
diff
,
diff1
;
Mat
diff
,
diff1
;
absdiff
(
canny
,
cannyVX
,
diff
);
absdiff
(
canny
,
cannyVX
,
diff
);
boxFilter
(
diff
,
diff1
,
-
1
,
Size
(
3
,
3
));
boxFilter
(
diff
,
diff1
,
-
1
,
Size
(
3
,
3
));
...
@@ -374,7 +391,7 @@ TEST_P(CannyVX, Accuracy)
...
@@ -374,7 +391,7 @@ TEST_P(CannyVX, Accuracy)
diff1
=
diff1
>
255
/
9
*
minPixelsAroud
;
diff1
=
diff1
>
255
/
9
*
minPixelsAroud
;
erode
(
diff1
,
diff1
,
Mat
());
erode
(
diff1
,
diff1
,
Mat
());
double
error
=
cv
::
norm
(
diff1
,
NORM_L1
)
/
255
;
double
error
=
cv
::
norm
(
diff1
,
NORM_L1
)
/
255
;
const
int
maxError
=
10
;
// empirical number
const
int
maxError
=
std
::
min
(
10
,
diff
.
size
().
area
()
/
100
)
;
// empirical number
if
(
error
>
maxError
)
if
(
error
>
maxError
)
{
{
string
outPath
=
string
outPath
=
...
...
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