mirror of
https://github.com/opencv/opencv.git
synced 2024-12-15 18:09:11 +08:00
9931da772d
Added charuco board generation to gen_pattern.py #23363 added charuco board generation in gen_pattern.py moved aruco_dict_utils.cpp to samples from opencv_contrib (https://github.com/opencv/opencv_contrib/pull/3464) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
57 lines
1.8 KiB
Python
Executable File
57 lines
1.8 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
from __future__ import print_function
|
|
|
|
import sys
|
|
sys.dont_write_bytecode = True # Don't generate .pyc files / __pycache__ directories
|
|
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
# Python 3 moved urlopen to urllib.requests
|
|
try:
|
|
from urllib.request import urlopen
|
|
except ImportError:
|
|
from urllib import urlopen
|
|
|
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
sys.path.append(os.path.join(os.path.split(basedir)[0], "modules", "python", "test"))
|
|
from tests_common import NewOpenCVTests
|
|
|
|
def load_tests(loader, tests, pattern):
|
|
cwd = os.getcwd()
|
|
config_file = 'opencv_apps_python_tests.cfg'
|
|
locations = [cwd, basedir]
|
|
if os.path.exists(config_file):
|
|
with open(config_file, 'r') as f:
|
|
locations += [str(s).strip() for s in f.readlines()]
|
|
else:
|
|
print('WARNING: OpenCV tests config file ({}) is missing, running subset of tests'.format(config_file))
|
|
|
|
tests_pattern = os.environ.get('OPENCV_APPS_TEST_FILTER', 'test_*') + '.py'
|
|
if tests_pattern != 'test_*.py':
|
|
print('Tests filter: {}'.format(tests_pattern))
|
|
|
|
processed = set()
|
|
for l in locations:
|
|
if not os.path.isabs(l):
|
|
l = os.path.normpath(os.path.join(cwd, l))
|
|
if l in processed:
|
|
continue
|
|
processed.add(l)
|
|
print('Discovering python tests from: {}'.format(l))
|
|
sys_path_modify = l not in sys.path
|
|
if sys_path_modify:
|
|
sys.path.append(l) # Hack python loader
|
|
discovered_tests = loader.discover(l, pattern=tests_pattern, top_level_dir=l)
|
|
print(' found {} tests'.format(discovered_tests.countTestCases()))
|
|
tests.addTests(loader.discover(l, pattern=tests_pattern))
|
|
if sys_path_modify:
|
|
sys.path.remove(l)
|
|
return tests
|
|
|
|
if __name__ == '__main__':
|
|
NewOpenCVTests.bootstrap()
|