-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
83 lines (68 loc) · 2.42 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"""main init file for package opencvlib"""
import os.path as _path
import cv2 as _cv2
IMAGE_EXTENSIONS = ['.bmp',
'.jpg',
'.jpeg',
'.png',
'.tif',
'.tiff',
'.pbm',
'.pgm',
'.ppm']
# IMAGE_EXTENSIONS.extend(list(map(str.upper, IMAGE_EXTENSIONS)))
IMAGE_EXTENSIONS_AS_WILDCARDS = ['*.bmp',
'*.jpg',
'*.jpeg',
'*.png',
'*.tif',
'*.tiff',
'*.pbm',
'*.pgm',
'*.ppm']
# IMAGE_EXTENSIONS_AS_WILDCARDS.extend(list(map(str.upper, IMAGE_EXTENSIONS_AS_WILDCARDS)))
# Global logger
# To use:
# <package>.info("informational message")
# <package>.debug("debug message")
# <package>.critical("informational message")
# try:
# import funclib.log as _log
# _logfile = _path.join(_log.RootLogger.USER_TEMP_FOLDER, 'opencvlib.log')
# _rootlogger = _log.RootLogger(_logfile)
# Log = _rootlogger.logger
# print('Logging to', _logfile)
# except Exception as e:
# print('Logger initialisation failed for file %s.\nError: %s' % (_logfile, str(e)))
# def loginfo():
# """print log file status"""
# try:
# print(_rootlogger)
# except Exception as e:
# print('Failed to get log info for file %s.\nError: %s' % (_logfile, str(e)))
def getimg(img, outflag=_cv2.IMREAD_UNCHANGED):
"""(ndarray|str)->ndarray
tries to load the image if its a path and returns the loaded ndarray
otherwise returns input img if it is an ndarray
Also consider using @decs._decs.decgetimg decorator
"""
if isinstance(img, str):
return _cv2.imread(_path.normpath(img), outflag)
return img
__all__ = ['classifiers', 'common',
'color',
'decs', 'display_utils', 'distance',
'edges', 'errors',
'faces', 'features',
'geom', 'getimg',
'histo', 'hogview',
'IMAGE_EXTENSIONS', 'IMAGE_EXTENSIONS_AS_WILDCARDS', 'info',
'keypoints',
'matcher',
'perspective', 'player',
'roi',
'streams',
'template_match', 'transforms',
'video',
'view',
'winpyr']