From 380c916c9221b144686de878eb0822fd38d06525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20B=C3=B8=20Fl=C3=B8ystad?= Date: Tue, 18 Jun 2013 18:36:23 +0200 Subject: [PATCH] transform.radon: Use correct padding for rectangular images. --- skimage/transform/radon_transform.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/skimage/transform/radon_transform.py b/skimage/transform/radon_transform.py index e3f46f30..fffe4e6f 100644 --- a/skimage/transform/radon_transform.py +++ b/skimage/transform/radon_transform.py @@ -74,9 +74,9 @@ def radon(image, theta=None, circle=False): out = np.zeros((min(padded_image.shape), len(theta))) else: height, width = image.shape - diagonal = np.sqrt(height**2 + width**2) - heightpad = np.ceil(diagonal - height) - widthpad = np.ceil(diagonal - width) + diagonal = np.sqrt(2) * max(image.shape) + heightpad = int(np.ceil(diagonal - height)) + widthpad = int(np.ceil(diagonal - width)) padded_image = np.zeros((int(height + heightpad), int(width + widthpad))) y0 = int(np.ceil(heightpad / 2))