Fix bug in array padding, template matching

This commit is contained in:
Johannes Schönberger
2013-12-08 18:54:02 +01:00
parent cff007827c
commit 783c04baec
8 changed files with 108 additions and 154 deletions
+1 -8
View File
@@ -3,14 +3,7 @@ from .dtype import (img_as_float, img_as_int, img_as_uint, img_as_ubyte,
from .shape import view_as_blocks, view_as_windows
from .noise import random_noise
import numpy
ver = numpy.__version__.split('.')
chk = int(ver[0] + ver[1])
if chk < 18: # Use internal version for numpy versions < 1.8.x
from .arraypad import pad
else:
from numpy import pad
del numpy, ver, chk
from .arraypad import pad
from ._regular_grid import regular_grid
from .unique import unique_rows
+5 -1
View File
@@ -1027,7 +1027,11 @@ def _normalize_shape(narray, shape):
"""
normshp = None
shapelen = len(np.shape(narray))
if (isinstance(shape, int)) or shape is None:
if isinstance(shape, np.ndarray):
shape = shape.tolist()
if isinstance(shape, (int, float)) or shape is None:
normshp = ((shape, shape), ) * shapelen
elif (isinstance(shape, (tuple, list))
and isinstance(shape[0], (tuple, list))