Clean up opencv namespace and imports.

This commit is contained in:
Stefan van der Walt
2009-10-17 12:28:33 +02:00
parent 83e66c57e6
commit 9025c5d3b0
2 changed files with 10 additions and 8 deletions
+8 -6
View File
@@ -1,14 +1,11 @@
import ctypes
import sys
from opencv_constants import *
# Note: users should be able to import this module even if
# the extensions are uncompiled or the opencv libraries unavailable.
# In that case, the opencv functionality is simply unavailable.
cv = None
cxcore = None
loaded = False
try:
from opencv_cv import *
except ImportError:
@@ -18,7 +15,12 @@ python setup.py build_ext -i
in the source directory to build in-place. Please refer to INSTALL.txt
for further detail."""
except RuntimeError:
# Libraries could not be loaded
print "*** Skipping import of OpenCV functions."
del (opencv_backend, opencv_cv)
else:
loaded = True
del opencv_constants
+2 -2
View File
@@ -11,13 +11,13 @@ with warnings.catch_warnings():
warnings.simplefilter("ignore")
from scikits.image.opencv import *
opencv_skip = dec.skipif(cv is None,
opencv_skip = dec.skipif(not loaded,
'OpenCV libraries not found')
class OpenCVTest:
lena_RGB_U8 = np.load(os.path.join(data_dir, 'lena_RGB_U8.npy'))
lena_GRAY_U8 = np.load(os.path.join(data_dir, 'lena_GRAY_U8.npy'))
class TestSobel(OpenCVTest):
@opencv_skip