From 973258ea13d21088342b8187012f0fa09634e4a2 Mon Sep 17 00:00:00 2001 From: Brandon Dube Date: Sat, 15 Dec 2018 18:48:58 -0500 Subject: [PATCH] improve convolvable from file --- prysm/convolution.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/prysm/convolution.py b/prysm/convolution.py index 5bd612ff..9ec927e6 100644 --- a/prysm/convolution.py +++ b/prysm/convolution.py @@ -5,6 +5,7 @@ import matplotlib as mpl from prysm import mathops as m +from .conf import config from .fttools import forward_ft_unit, pad2d from .util import share_fig_ax @@ -380,20 +381,17 @@ def from_file(path, scale): Returns ------- - `Image` + `Convolvable` a new image object - Notes - ----- - TODO: proper handling of images with more than 8bpp. - ''' from imageio import imread - imgarr = imread(path, flatten=True, pilmode='F') + imgarr = imread(path) s = imgarr.shape extx, exty = s[0] * scale // 2, s[1] * scale // 2 ux, uy = m.arange(-extx, exty, scale), m.arange(-exty, exty, scale) - return Convolvable(data=m.flip(imgarr, axis=0) / 255, unit_x=ux, unit_y=uy, has_analytic_ft=False) + return Convolvable(data=m.flip(imgarr, axis=0).astype(config.precision), + unit_x=ux, unit_y=uy, has_analytic_ft=False) def _conv(convolvable1, convolvable2):