mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-12 12:30:16 +08:00
Clean up opencv namespace and imports.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user