Skip to content

Commit 59d5b8c

Browse files
committed
finished debug of color detection
1 parent 97eedb8 commit 59d5b8c

42 files changed

Lines changed: 1368 additions & 1204 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

imagedb/pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ ignore-comments=yes
240240
ignore-docstrings=yes
241241

242242
# Ignore imports when computing similarities.
243-
ignore-imports=no
243+
ignore-imports=yes
244244

245245

246246
[SPELLING]

joshi/joshi.pyproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
<Compile Include="c9\optical_flow.py" />
9191
</ItemGroup>
9292
<ItemGroup>
93+
<Content Include="pylintrc" />
9394
<Content Include="training_images\1305083121687.jpg" />
9495
<Content Include="training_images\9908f84474270b07.jpg" />
9596
<Content Include="training_images\a-european-sea-bass-dicentrarchus-labrax-caught-on-a-west-wales-surf-F00MM3.jpg" />

opencvlib/__init__.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
'''opencvlib'''
2-
from opencvlib.common import getimg, show, checkwaitkey, getwaitkey, showarray, play
3-
from opencvlib.common import ImageInfo, Info, mosaic, eImgType, CVColors
1+
'''main init file for package opencvlib'''
2+
import os.path as _path
3+
4+
import cv2 as _cv2
5+
46

57

68
IMAGE_EXTENSIONS = ('.bmp',
@@ -24,7 +26,7 @@
2426
'*.ppm')
2527

2628
__all__ = ['classifiers', 'common',
27-
'decs', 'distance',
29+
'color', 'decs', 'distance',
2830
'edges', 'errors',
2931
'faces', 'features',
3032
'hogview', 'keypoints',
@@ -39,7 +41,6 @@
3941
#<package>.debug("debug message")
4042
#<package>.critical("informational message")
4143
try:
42-
import os.path as _path
4344
import funclib.log as _log
4445
_logfile = _path.join(_log.RootLogger.USER_TEMP_FOLDER, 'opencvlib.log')
4546
_rootlogger = _log.RootLogger(_logfile)
@@ -55,3 +56,17 @@ def loginfo():
5556
print(_rootlogger)
5657
except Exception as e:
5758
print('Failed to get log info for file %s.\nError: %s' % (_logfile, str(e)))
59+
60+
61+
62+
def getimg(img, outflag=_cv2.IMREAD_UNCHANGED):
63+
'''(ndarray|str)->ndarray
64+
tries to load the image if its a path and returns the loaded ndarray
65+
otherwise returns input img if it is an ndarray
66+
67+
Also consider using @decs._decs.decgetimg decorator
68+
'''
69+
if isinstance(img, str):
70+
return _cv2.imread(_path.normpath(img), outflag)
71+
72+
return img

0 commit comments

Comments
 (0)