From b1b1c343b452b32371db7a5c6422afd8fce16c4c Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Sat, 16 Jun 2012 19:15:20 +0200 Subject: [PATCH] MISC remove debugging tracer, unnecessary variable. --- skimage/segmentation/felzenszwalb.pyx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/skimage/segmentation/felzenszwalb.pyx b/skimage/segmentation/felzenszwalb.pyx index 5a0ecbac..a53bf70e 100644 --- a/skimage/segmentation/felzenszwalb.pyx +++ b/skimage/segmentation/felzenszwalb.pyx @@ -7,9 +7,6 @@ import scipy #from ..color import rgb2grey from skimage.morphology.ccomp cimport find_root, join_trees -from IPython.core.debugger import Tracer -tracer = Tracer() - def felzenszwalb_segmentation(image, k, sigma=0.8): k = float(k) @@ -29,16 +26,15 @@ def felzenszwalb_segmentation(image, k, sigma=0.8): dright_cost.ravel(), uright_cost.ravel()]) # compute edges between pixels: width, height = image.shape[:2] - indices = np.arange(width * height).reshape(width, height) - right_edges = np.c_[indices[1:, :].ravel(), indices[:-1, :].ravel()] - down_edges = np.c_[indices[:, 1:].ravel(), indices[:, :-1].ravel()] - dright_edges = np.c_[indices[1:, 1:].ravel(), indices[:-1, :-1].ravel()] - uright_edges = np.c_[indices[:-1, 1:].ravel(), indices[1:, :-1].ravel()] + cdef np.ndarray[np.int_t, ndim=2] segments = np.arange(width * height).reshape(width, height) + right_edges = np.c_[segments[1:, :].ravel(), segments[:-1, :].ravel()] + down_edges = np.c_[segments[:, 1:].ravel(), segments[:, :-1].ravel()] + dright_edges = np.c_[segments[1:, 1:].ravel(), segments[:-1, :-1].ravel()] + uright_edges = np.c_[segments[:-1, 1:].ravel(), segments[1:, :-1].ravel()] edges = np.vstack([right_edges, down_edges, dright_edges, uright_edges]) # initialize data structures for segment size # and inner cost, then start greedy iteration over edges. edge_queue = np.argsort(costs) - cdef np.ndarray[np.int_t, ndim=2] segments = indices.reshape(width, height) cdef np.int_t *segments_p = segments.data cdef np.int_t seg_new segment_size = defaultdict(lambda: 1)