Merge pull request #5323 from radarhere/imagefilter_numpy

Only import numpy when necessary
This commit is contained in:
Hugo van Kemenade 2021-03-28 19:11:01 +03:00 committed by GitHub
commit b3a1de94d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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()