From 257502c099d77e0d3bac2ed24dde5ed093a0345d Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Mon, 12 Jan 2015 12:09:22 +1100 Subject: [PATCH] Prevent unnecessary array copy for RGB images --- skimage/segmentation/boundaries.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skimage/segmentation/boundaries.py b/skimage/segmentation/boundaries.py index 583d593b..67763bbb 100644 --- a/skimage/segmentation/boundaries.py +++ b/skimage/segmentation/boundaries.py @@ -196,9 +196,9 @@ def mark_boundaries(image, label_img, color=(1, 1, 0), -------- ``find_boundaries``. """ - if image.ndim == 2: - image = gray2rgb(image) marked = img_as_float(image, force_copy=True) + if marked.ndim == 2: + marked = gray2rgb(marked) if mode == 'subpixel': marked = nd.zoom(marked, [2 - 1/s for s in marked.shape[:-1]] + [1], mode='reflect')