Only import numpy when necessary

This commit is contained in:
Andrew Murray 2021-03-12 12:03:45 +11:00
parent f91f93e246
commit 188d4f6b6a

View File

@ -16,11 +16,6 @@
#
import functools
try:
import numpy
except ImportError: # pragma: no cover
numpy = None
class Filter:
pass
@ -369,6 +364,13 @@ class Color3DLUT(MultibandFilter):
items = size[0] * size[1] * size[2]
wrong_size = False
numpy = None
if hasattr(table, "shape"):
try:
import numpy
except ImportError: # pragma: no cover
pass
if numpy and isinstance(table, numpy.ndarray):
if copy_table:
table = table.copy()