def use(pkgname): global have_opencv, cv2, cv2_resize global have_opencl, trcalc_cl if pkgname == 'opencv': import cv2 have_opencv = True cv2_resize = { 'nearest': cv2.INTER_NEAREST, 'linear': cv2.INTER_LINEAR, 'area': cv2.INTER_AREA, 'bicubic': cv2.INTER_CUBIC, 'lanczos': cv2.INTER_LANCZOS4, } if not 'nearest' in interpolation_methods: interpolation_methods.extend(cv2_resize.keys()) interpolation_methods.sort() elif pkgname == 'opencl': try: from ginga.opencl import CL have_opencl = True trcalc_cl = CL.CL('trcalc.cl') except Exception as e: raise ImportError(e)
def use(pkgname): global have_opencl, trcalc_cl global _use if pkgname == 'opencv': _use = 'opencv' elif pkgname == 'pillow': _use = 'pillow' elif pkgname == 'opencl': try: from ginga.opencl import CL have_opencl = True _use = 'opencl' trcalc_cl = CL.CL('trcalc.cl') except Exception as e: raise ImportError(e)