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
7791839f
Commit
7791839f
authored
Sep 03, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python(test): tests filtering
parent
2f946378
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
139 additions
and
75 deletions
+139
-75
test.py
modules/python/test/test.py
+3
-31
test_calibration.py
modules/python/test/test_calibration.py
+5
-0
test_camshift.py
modules/python/test/test_camshift.py
+5
-2
test_dft.py
modules/python/test/test_dft.py
+5
-2
test_digits.py
modules/python/test/test_digits.py
+5
-2
test_facedetect.py
modules/python/test/test_facedetect.py
+5
-2
test_feature_homography.py
modules/python/test/test_feature_homography.py
+5
-2
test_fitline.py
modules/python/test/test_fitline.py
+5
-2
test_gaussian_mix.py
modules/python/test/test_gaussian_mix.py
+5
-2
test_goodfeatures.py
modules/python/test/test_goodfeatures.py
+5
-2
test_grabcut.py
modules/python/test/test_grabcut.py
+5
-2
test_houghcircles.py
modules/python/test/test_houghcircles.py
+5
-2
test_houghlines.py
modules/python/test/test_houghlines.py
+5
-2
test_kmeans.py
modules/python/test/test_kmeans.py
+5
-2
test_legacy.py
modules/python/test/test_legacy.py
+2
-2
test_letter_recog.py
modules/python/test/test_letter_recog.py
+5
-2
test_lk_homography.py
modules/python/test/test_lk_homography.py
+4
-0
test_lk_track.py
modules/python/test/test_lk_track.py
+5
-2
test_misc.py
modules/python/test/test_misc.py
+1
-2
test_morphology.py
modules/python/test/test_morphology.py
+4
-2
test_mser.py
modules/python/test/test_mser.py
+3
-0
test_peopledetect.py
modules/python/test/test_peopledetect.py
+4
-2
test_shape.py
modules/python/test/test_shape.py
+3
-0
test_squares.py
modules/python/test/test_squares.py
+4
-2
test_stitching.py
modules/python/test/test_stitching.py
+3
-0
test_texture_flow.py
modules/python/test/test_texture_flow.py
+3
-0
test_umat.py
modules/python/test/test_umat.py
+1
-2
test_watershed.py
modules/python/test/test_watershed.py
+4
-2
tests_common.py
modules/python/test/tests_common.py
+25
-2
No files found.
modules/python/test/test.py
View file @
7791839f
#!/usr/bin/env python
#!/usr/bin/env python
from
__future__
import
print_function
from
__future__
import
print_function
import
unittest
import
random
import
time
import
math
import
sys
import
array
import
tarfile
import
hashlib
import
os
import
os
import
getopt
import
unittest
import
operator
import
functools
import
numpy
as
np
import
cv2
import
argparse
# Python 3 moved urlopen to urllib.requests
# Python 3 moved urlopen to urllib.requests
try
:
try
:
...
@@ -25,7 +13,6 @@ except ImportError:
...
@@ -25,7 +13,6 @@ except ImportError:
from
tests_common
import
NewOpenCVTests
from
tests_common
import
NewOpenCVTests
# Tests to run first; check the handful of basic operations that the later tests rely on
basedir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
basedir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
...
@@ -34,19 +21,4 @@ def load_tests(loader, tests, pattern):
...
@@ -34,19 +21,4 @@ def load_tests(loader, tests, pattern):
return
tests
return
tests
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
(
description
=
'run OpenCV python tests'
)
NewOpenCVTests
.
bootstrap
()
parser
.
add_argument
(
'--repo'
,
help
=
'use sample image files from local git repository (path to folder), '
'if not set, samples will be downloaded from github.com'
)
parser
.
add_argument
(
'--data'
,
help
=
'<not used> use data files from local folder (path to folder), '
'if not set, data files will be downloaded from docs.opencv.org'
)
args
,
other
=
parser
.
parse_known_args
()
print
(
"Testing OpenCV"
,
cv2
.
__version__
)
print
(
"Local repo path:"
,
args
.
repo
)
NewOpenCVTests
.
repoPath
=
args
.
repo
try
:
NewOpenCVTests
.
extraTestDataPath
=
os
.
environ
[
'OPENCV_TEST_DATA_PATH'
]
except
KeyError
:
print
(
'Missing opencv extra repository. Some of tests may fail.'
)
random
.
seed
(
0
)
unit_argv
=
[
sys
.
argv
[
0
]]
+
other
unittest
.
main
(
argv
=
unit_argv
)
modules/python/test/test_calibration.py
View file @
7791839f
...
@@ -66,3 +66,8 @@ class calibration_test(NewOpenCVTests):
...
@@ -66,3 +66,8 @@ class calibration_test(NewOpenCVTests):
self
.
assertLess
(
abs
(
rms
-
0.196334638034
),
eps
)
self
.
assertLess
(
abs
(
rms
-
0.196334638034
),
eps
)
self
.
assertLess
(
cv2
.
norm
(
camera_matrix
-
cameraMatrixTest
,
cv2
.
NORM_L1
),
normCamEps
)
self
.
assertLess
(
cv2
.
norm
(
camera_matrix
-
cameraMatrixTest
,
cv2
.
NORM_L1
),
normCamEps
)
self
.
assertLess
(
cv2
.
norm
(
dist_coefs
-
distCoeffsTest
,
cv2
.
NORM_L1
),
normDistEps
)
self
.
assertLess
(
cv2
.
norm
(
dist_coefs
-
distCoeffsTest
,
cv2
.
NORM_L1
),
normDistEps
)
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_camshift.py
View file @
7791839f
...
@@ -89,4 +89,8 @@ class camshift_test(NewOpenCVTests):
...
@@ -89,4 +89,8 @@ class camshift_test(NewOpenCVTests):
def
test_camshift
(
self
):
def
test_camshift
(
self
):
self
.
prepareRender
()
self
.
prepareRender
()
self
.
runTracker
()
self
.
runTracker
()
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_dft.py
View file @
7791839f
...
@@ -43,4 +43,8 @@ class dft_test(NewOpenCVTests):
...
@@ -43,4 +43,8 @@ class dft_test(NewOpenCVTests):
img_backTest
=
cv2
.
normalize
(
img_backTest
,
0.0
,
1.0
,
cv2
.
NORM_MINMAX
)
img_backTest
=
cv2
.
normalize
(
img_backTest
,
0.0
,
1.0
,
cv2
.
NORM_MINMAX
)
img_back
=
cv2
.
normalize
(
img_back
,
0.0
,
1.0
,
cv2
.
NORM_MINMAX
)
img_back
=
cv2
.
normalize
(
img_back
,
0.0
,
1.0
,
cv2
.
NORM_MINMAX
)
self
.
assertLess
(
cv2
.
norm
(
img_back
-
img_backTest
),
eps
)
self
.
assertLess
(
cv2
.
norm
(
img_back
-
img_backTest
),
eps
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_digits.py
View file @
7791839f
...
@@ -194,4 +194,8 @@ class digits_test(NewOpenCVTests):
...
@@ -194,4 +194,8 @@ class digits_test(NewOpenCVTests):
self
.
assertLess
(
cv2
.
norm
(
confusionMatrixes
[
1
]
-
confusionSVM
,
cv2
.
NORM_L1
),
normEps
)
self
.
assertLess
(
cv2
.
norm
(
confusionMatrixes
[
1
]
-
confusionSVM
,
cv2
.
NORM_L1
),
normEps
)
self
.
assertLess
(
errors
[
0
]
-
0.034
,
eps
)
self
.
assertLess
(
errors
[
0
]
-
0.034
,
eps
)
self
.
assertLess
(
errors
[
1
]
-
0.018
,
eps
)
self
.
assertLess
(
errors
[
1
]
-
0.018
,
eps
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_facedetect.py
View file @
7791839f
...
@@ -85,4 +85,8 @@ class facedetect_test(NewOpenCVTests):
...
@@ -85,4 +85,8 @@ class facedetect_test(NewOpenCVTests):
eyes_matches
+=
1
eyes_matches
+=
1
self
.
assertEqual
(
faces_matches
,
2
)
self
.
assertEqual
(
faces_matches
,
2
)
self
.
assertEqual
(
eyes_matches
,
2
)
self
.
assertEqual
(
eyes_matches
,
2
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_feature_homography.py
View file @
7791839f
...
@@ -157,4 +157,8 @@ class PlaneTracker:
...
@@ -157,4 +157,8 @@ class PlaneTracker:
keypoints
,
descrs
=
self
.
detector
.
detectAndCompute
(
frame
,
None
)
keypoints
,
descrs
=
self
.
detector
.
detectAndCompute
(
frame
,
None
)
if
descrs
is
None
:
# detectAndCompute returns descs=None if no keypoints found
if
descrs
is
None
:
# detectAndCompute returns descs=None if no keypoints found
descrs
=
[]
descrs
=
[]
return
keypoints
,
descrs
return
keypoints
,
descrs
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_fitline.py
View file @
7791839f
...
@@ -63,4 +63,8 @@ class fitline_test(NewOpenCVTests):
...
@@ -63,4 +63,8 @@ class fitline_test(NewOpenCVTests):
refVec
=
(
np
.
float32
(
p1
)
-
p0
)
/
cv2
.
norm
(
np
.
float32
(
p1
)
-
p0
)
refVec
=
(
np
.
float32
(
p1
)
-
p0
)
/
cv2
.
norm
(
np
.
float32
(
p1
)
-
p0
)
for
i
in
range
(
len
(
lines
)):
for
i
in
range
(
len
(
lines
)):
self
.
assertLessEqual
(
cv2
.
norm
(
refVec
-
lines
[
i
][
0
:
2
],
cv2
.
NORM_L2
),
eps
)
self
.
assertLessEqual
(
cv2
.
norm
(
refVec
-
lines
[
i
][
0
:
2
],
cv2
.
NORM_L2
),
eps
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_gaussian_mix.py
View file @
7791839f
...
@@ -57,4 +57,8 @@ class gaussian_mix_test(NewOpenCVTests):
...
@@ -57,4 +57,8 @@ class gaussian_mix_test(NewOpenCVTests):
cv2
.
norm
(
covs
[
i
]
-
ref_distrs
[
j
][
1
],
cv2
.
NORM_L2
)
/
cv2
.
norm
(
ref_distrs
[
j
][
1
],
cv2
.
NORM_L2
)
<
covEps
):
cv2
.
norm
(
covs
[
i
]
-
ref_distrs
[
j
][
1
],
cv2
.
NORM_L2
)
/
cv2
.
norm
(
ref_distrs
[
j
][
1
],
cv2
.
NORM_L2
)
<
covEps
):
matches_count
+=
1
matches_count
+=
1
self
.
assertEqual
(
matches_count
,
cluster_n
)
self
.
assertEqual
(
matches_count
,
cluster_n
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_goodfeatures.py
View file @
7791839f
...
@@ -33,4 +33,8 @@ class TestGoodFeaturesToTrack_test(NewOpenCVTests):
...
@@ -33,4 +33,8 @@ class TestGoodFeaturesToTrack_test(NewOpenCVTests):
self
.
assertTrue
(
len
(
r0
)
>
len
(
r1
))
self
.
assertTrue
(
len
(
r0
)
>
len
(
r1
))
# Increasing thresh should monly truncate result list
# Increasing thresh should monly truncate result list
for
i
in
range
(
len
(
r1
)):
for
i
in
range
(
len
(
r1
)):
self
.
assertTrue
(
cv2
.
norm
(
r1
[
i
][
0
]
-
r0
[
i
][
0
])
==
0
)
self
.
assertTrue
(
cv2
.
norm
(
r1
[
i
][
0
]
-
r0
[
i
][
0
])
==
0
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_grabcut.py
View file @
7791839f
...
@@ -64,4 +64,8 @@ class grabcut_test(NewOpenCVTests):
...
@@ -64,4 +64,8 @@ class grabcut_test(NewOpenCVTests):
exp_mask2
=
self
.
scaleMask
(
mask
)
exp_mask2
=
self
.
scaleMask
(
mask
)
cv2
.
imwrite
(
self
.
extraTestDataPath
+
'/cv/grabcut/exp_mask2py.png'
,
exp_mask2
)
cv2
.
imwrite
(
self
.
extraTestDataPath
+
'/cv/grabcut/exp_mask2py.png'
,
exp_mask2
)
self
.
assertEqual
(
self
.
verify
(
self
.
scaleMask
(
mask
),
exp_mask2
),
True
)
self
.
assertEqual
(
self
.
verify
(
self
.
scaleMask
(
mask
),
exp_mask2
),
True
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_houghcircles.py
View file @
7791839f
...
@@ -77,4 +77,8 @@ class houghcircles_test(NewOpenCVTests):
...
@@ -77,4 +77,8 @@ class houghcircles_test(NewOpenCVTests):
matches_counter
+=
1
matches_counter
+=
1
self
.
assertGreater
(
float
(
matches_counter
)
/
len
(
testCircles
),
.
5
)
self
.
assertGreater
(
float
(
matches_counter
)
/
len
(
testCircles
),
.
5
)
self
.
assertLess
(
float
(
len
(
circles
)
-
matches_counter
)
/
len
(
circles
),
.
75
)
self
.
assertLess
(
float
(
len
(
circles
)
-
matches_counter
)
/
len
(
circles
),
.
75
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_houghlines.py
View file @
7791839f
...
@@ -62,4 +62,8 @@ class houghlines_test(NewOpenCVTests):
...
@@ -62,4 +62,8 @@ class houghlines_test(NewOpenCVTests):
if
linesDiff
(
testLines
[
i
],
lines
[
j
])
<
eps
:
if
linesDiff
(
testLines
[
i
],
lines
[
j
])
<
eps
:
matches_counter
+=
1
matches_counter
+=
1
self
.
assertGreater
(
float
(
matches_counter
)
/
len
(
testLines
),
.
7
)
self
.
assertGreater
(
float
(
matches_counter
)
/
len
(
testLines
),
.
7
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_kmeans.py
View file @
7791839f
...
@@ -67,4 +67,8 @@ class kmeans_test(NewOpenCVTests):
...
@@ -67,4 +67,8 @@ class kmeans_test(NewOpenCVTests):
for
i
in
range
(
cluster_n
):
for
i
in
range
(
cluster_n
):
confidence
=
getMainLabelConfidence
(
labels
[
offset
:
(
offset
+
clusterSizes
[
i
])],
cluster_n
)
confidence
=
getMainLabelConfidence
(
labels
[
offset
:
(
offset
+
clusterSizes
[
i
])],
cluster_n
)
offset
+=
clusterSizes
[
i
]
offset
+=
clusterSizes
[
i
]
self
.
assertGreater
(
confidence
,
0.9
)
self
.
assertGreater
(
confidence
,
0.9
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_legacy.py
View file @
7791839f
...
@@ -84,6 +84,6 @@ class Hackathon244Tests(NewOpenCVTests):
...
@@ -84,6 +84,6 @@ class Hackathon244Tests(NewOpenCVTests):
self
.
check_close_pairs
(
mc
,
mc0
,
5
)
self
.
check_close_pairs
(
mc
,
mc0
,
5
)
self
.
assertLessEqual
(
abs
(
mr
-
mr0
),
5
)
self
.
assertLessEqual
(
abs
(
mr
-
mr0
),
5
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
unittest
NewOpenCVTests
.
bootstrap
()
unittest
.
main
()
modules/python/test/test_letter_recog.py
View file @
7791839f
...
@@ -164,4 +164,8 @@ class letter_recog_test(NewOpenCVTests):
...
@@ -164,4 +164,8 @@ class letter_recog_test(NewOpenCVTests):
test_rate
=
np
.
mean
(
classifier
.
predict
(
samples
[
train_n
:])
==
responses
[
train_n
:]
.
astype
(
int
))
test_rate
=
np
.
mean
(
classifier
.
predict
(
samples
[
train_n
:])
==
responses
[
train_n
:]
.
astype
(
int
))
self
.
assertLess
(
train_rate
-
testErrors
[
Model
][
0
],
eps
)
self
.
assertLess
(
train_rate
-
testErrors
[
Model
][
0
],
eps
)
self
.
assertLess
(
test_rate
-
testErrors
[
Model
][
1
],
eps
)
self
.
assertLess
(
test_rate
-
testErrors
[
Model
][
1
],
eps
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_lk_homography.py
View file @
7791839f
...
@@ -94,3 +94,7 @@ class lk_homography_test(NewOpenCVTests):
...
@@ -94,3 +94,7 @@ class lk_homography_test(NewOpenCVTests):
self
.
p0
=
cv2
.
goodFeaturesToTrack
(
frame_gray
,
**
feature_params
)
self
.
p0
=
cv2
.
goodFeaturesToTrack
(
frame_gray
,
**
feature_params
)
self
.
assertEqual
(
isForegroundHomographyFound
,
True
)
self
.
assertEqual
(
isForegroundHomographyFound
,
True
)
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_lk_track.py
View file @
7791839f
...
@@ -108,4 +108,8 @@ class lk_track_test(NewOpenCVTests):
...
@@ -108,4 +108,8 @@ class lk_track_test(NewOpenCVTests):
self
.
prev_gray
=
frame_gray
self
.
prev_gray
=
frame_gray
if
self
.
frame_idx
>
300
:
if
self
.
frame_idx
>
300
:
break
break
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_misc.py
View file @
7791839f
...
@@ -19,5 +19,4 @@ class Bindings(NewOpenCVTests):
...
@@ -19,5 +19,4 @@ class Bindings(NewOpenCVTests):
boost
.
isClassifier
()
# from ml::StatModel
boost
.
isClassifier
()
# from ml::StatModel
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
unittest
NewOpenCVTests
.
bootstrap
()
unittest
.
main
()
modules/python/test/test_morphology.py
View file @
7791839f
...
@@ -48,4 +48,7 @@ class morphology_test(NewOpenCVTests):
...
@@ -48,4 +48,7 @@ class morphology_test(NewOpenCVTests):
for
mode
in
modes
:
for
mode
in
modes
:
res
=
update
(
mode
)
res
=
update
(
mode
)
self
.
assertEqual
(
self
.
hashimg
(
res
),
referenceHashes
[
mode
])
self
.
assertEqual
(
self
.
hashimg
(
res
),
referenceHashes
[
mode
])
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_mser.py
View file @
7791839f
...
@@ -67,3 +67,6 @@ class mser_test(NewOpenCVTests):
...
@@ -67,3 +67,6 @@ class mser_test(NewOpenCVTests):
self
.
assertEqual
(
nmsers
,
len
(
boxes
))
self
.
assertEqual
(
nmsers
,
len
(
boxes
))
self
.
assertLessEqual
(
minRegs
,
nmsers
)
self
.
assertLessEqual
(
minRegs
,
nmsers
)
self
.
assertGreaterEqual
(
maxRegs
,
nmsers
)
self
.
assertGreaterEqual
(
maxRegs
,
nmsers
)
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_peopledetect.py
View file @
7791839f
...
@@ -59,4 +59,7 @@ class peopledetect_test(NewOpenCVTests):
...
@@ -59,4 +59,7 @@ class peopledetect_test(NewOpenCVTests):
if
intersectionRate
(
found_rect
,
testPeople
[
j
][
0
])
>
eps
or
intersectionRate
(
found_rect
,
testPeople
[
j
][
1
])
>
eps
:
if
intersectionRate
(
found_rect
,
testPeople
[
j
][
0
])
>
eps
or
intersectionRate
(
found_rect
,
testPeople
[
j
][
1
])
>
eps
:
matches
+=
1
matches
+=
1
self
.
assertGreater
(
matches
,
0
)
self
.
assertGreater
(
matches
,
0
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_shape.py
View file @
7791839f
...
@@ -21,3 +21,6 @@ class shape_test(NewOpenCVTests):
...
@@ -21,3 +21,6 @@ class shape_test(NewOpenCVTests):
self
.
assertAlmostEqual
(
d1
,
26.4196891785
,
3
,
"HausdorffDistanceExtractor"
)
self
.
assertAlmostEqual
(
d1
,
26.4196891785
,
3
,
"HausdorffDistanceExtractor"
)
self
.
assertAlmostEqual
(
d2
,
0.25804194808
,
3
,
"ShapeContextDistanceExtractor"
)
self
.
assertAlmostEqual
(
d2
,
0.25804194808
,
3
,
"ShapeContextDistanceExtractor"
)
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_squares.py
View file @
7791839f
...
@@ -93,4 +93,7 @@ class squares_test(NewOpenCVTests):
...
@@ -93,4 +93,7 @@ class squares_test(NewOpenCVTests):
matches_counter
+=
1
matches_counter
+=
1
self
.
assertGreater
(
matches_counter
/
len
(
testSquares
),
0.9
)
self
.
assertGreater
(
matches_counter
/
len
(
testSquares
),
0.9
)
self
.
assertLess
(
(
len
(
squares
)
-
matches_counter
)
/
len
(
squares
),
0.2
)
self
.
assertLess
(
(
len
(
squares
)
-
matches_counter
)
/
len
(
squares
),
0.2
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_stitching.py
View file @
7791839f
...
@@ -18,3 +18,6 @@ class stitching_test(NewOpenCVTests):
...
@@ -18,3 +18,6 @@ class stitching_test(NewOpenCVTests):
self
.
assertAlmostEqual
(
pano
.
shape
[
0
],
685
,
delta
=
100
,
msg
=
"rows:
%
r"
%
list
(
pano
.
shape
))
self
.
assertAlmostEqual
(
pano
.
shape
[
0
],
685
,
delta
=
100
,
msg
=
"rows:
%
r"
%
list
(
pano
.
shape
))
self
.
assertAlmostEqual
(
pano
.
shape
[
1
],
1025
,
delta
=
100
,
msg
=
"cols:
%
r"
%
list
(
pano
.
shape
))
self
.
assertAlmostEqual
(
pano
.
shape
[
1
],
1025
,
delta
=
100
,
msg
=
"cols:
%
r"
%
list
(
pano
.
shape
))
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_texture_flow.py
View file @
7791839f
...
@@ -42,3 +42,6 @@ class texture_flow_test(NewOpenCVTests):
...
@@ -42,3 +42,6 @@ class texture_flow_test(NewOpenCVTests):
for
i
in
range
(
len
(
textureVectors
)):
for
i
in
range
(
len
(
textureVectors
)):
self
.
assertTrue
(
cv2
.
norm
(
textureVectors
[
i
],
cv2
.
NORM_L2
)
<
eps
self
.
assertTrue
(
cv2
.
norm
(
textureVectors
[
i
],
cv2
.
NORM_L2
)
<
eps
or
abs
(
cv2
.
norm
(
textureVectors
[
i
],
cv2
.
NORM_L2
)
-
d
)
<
eps
)
or
abs
(
cv2
.
norm
(
textureVectors
[
i
],
cv2
.
NORM_L2
)
-
d
)
<
eps
)
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/test_umat.py
View file @
7791839f
...
@@ -83,5 +83,4 @@ class UMat(NewOpenCVTests):
...
@@ -83,5 +83,4 @@ class UMat(NewOpenCVTests):
# self.assertTrue(np.allclose(data, data_umat))
# self.assertTrue(np.allclose(data, data_umat))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
unittest
NewOpenCVTests
.
bootstrap
()
unittest
.
main
()
modules/python/test/test_watershed.py
View file @
7791839f
...
@@ -30,4 +30,7 @@ class watershed_test(NewOpenCVTests):
...
@@ -30,4 +30,7 @@ class watershed_test(NewOpenCVTests):
refSegments
=
segments
.
copy
()
refSegments
=
segments
.
copy
()
cv2
.
imwrite
(
self
.
extraTestDataPath
+
'/cv/watershed/wshed_segments.png'
,
refSegments
)
cv2
.
imwrite
(
self
.
extraTestDataPath
+
'/cv/watershed/wshed_segments.png'
,
refSegments
)
self
.
assertLess
(
cv2
.
norm
(
segments
-
refSegments
,
cv2
.
NORM_L1
)
/
255.0
,
50
)
self
.
assertLess
(
cv2
.
norm
(
segments
-
refSegments
,
cv2
.
NORM_L1
)
/
255.0
,
50
)
\ No newline at end of file
if
__name__
==
'__main__'
:
NewOpenCVTests
.
bootstrap
()
modules/python/test/tests_common.py
View file @
7791839f
...
@@ -2,10 +2,13 @@
...
@@ -2,10 +2,13 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
unittest
import
os
import
sys
import
sys
import
unittest
import
hashlib
import
hashlib
import
os
import
random
import
argparse
import
numpy
as
np
import
numpy
as
np
import
cv2
import
cv2
...
@@ -62,6 +65,26 @@ class NewOpenCVTests(unittest.TestCase):
...
@@ -62,6 +65,26 @@ class NewOpenCVTests(unittest.TestCase):
if
not
a
>
b
:
if
not
a
>
b
:
self
.
fail
(
'
%
s not greater than
%
s'
%
(
repr
(
a
),
repr
(
b
)))
self
.
fail
(
'
%
s not greater than
%
s'
%
(
repr
(
a
),
repr
(
b
)))
@staticmethod
def
bootstrap
():
parser
=
argparse
.
ArgumentParser
(
description
=
'run OpenCV python tests'
)
parser
.
add_argument
(
'--repo'
,
help
=
'use sample image files from local git repository (path to folder), '
'if not set, samples will be downloaded from github.com'
)
parser
.
add_argument
(
'--data'
,
help
=
'<not used> use data files from local folder (path to folder), '
'if not set, data files will be downloaded from docs.opencv.org'
)
args
,
other
=
parser
.
parse_known_args
()
print
(
"Testing OpenCV"
,
cv2
.
__version__
)
print
(
"Local repo path:"
,
args
.
repo
)
NewOpenCVTests
.
repoPath
=
args
.
repo
try
:
NewOpenCVTests
.
extraTestDataPath
=
os
.
environ
[
'OPENCV_TEST_DATA_PATH'
]
except
KeyError
:
print
(
'Missing opencv extra repository. Some of tests may fail.'
)
random
.
seed
(
0
)
unit_argv
=
[
sys
.
argv
[
0
]]
+
other
unittest
.
main
(
argv
=
unit_argv
)
def
intersectionRate
(
s1
,
s2
):
def
intersectionRate
(
s1
,
s2
):
x1
,
y1
,
x2
,
y2
=
s1
x1
,
y1
,
x2
,
y2
=
s1
...
...
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