def _read_image(self, image_name):
"""
Read image from self._path_to_img and perform any necessary preparation
:param image_name: string, image name, which is added to self._path_to_img
:return: numpy 2d array
"""
filename = image_name
try:
img = io.imread(filename)
except IOError:
return None
img = img_as_float(img)
if len(img.shape) > 2:
img = img[:, :, 0]
img = resize(img, (self._image_width, self._image_height))
img = img.reshape((self._image_width, self._image_height, 1))
return img
评论列表
文章目录