mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 20:42:39 +02:00
Image is a PIL requirement and should only be imported when actually using it
This commit is contained in:
parent
0b4471a7cd
commit
c883d9e599
1 changed files with 1 additions and 1 deletions
|
|
@ -4,7 +4,6 @@ import GPy
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib as mpl
|
import matplotlib as mpl
|
||||||
import time
|
import time
|
||||||
import Image
|
|
||||||
try:
|
try:
|
||||||
import visual
|
import visual
|
||||||
visual_available = True
|
visual_available = True
|
||||||
|
|
@ -323,6 +322,7 @@ class image_show(matplotlib_show):
|
||||||
else:
|
else:
|
||||||
self.vals = 255*(self.vals - self.vals.min())/(self.vals.max() - self.vals.min())
|
self.vals = 255*(self.vals - self.vals.min())/(self.vals.max() - self.vals.min())
|
||||||
if not self.palette == []: # applying using an image palette (e.g. if the image has been quantized)
|
if not self.palette == []: # applying using an image palette (e.g. if the image has been quantized)
|
||||||
|
from PIL import Image
|
||||||
self.vals = Image.fromarray(self.vals.astype('uint8'))
|
self.vals = Image.fromarray(self.vals.astype('uint8'))
|
||||||
self.vals.putpalette(self.palette) # palette is a list, must be loaded before calling this function
|
self.vals.putpalette(self.palette) # palette is a list, must be loaded before calling this function
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue