From cf98558196d5b0d57c413b82a0873462234689ce Mon Sep 17 00:00:00 2001 From: Vighnesh Birodkar Date: Sat, 6 Jun 2015 21:51:36 +0530 Subject: [PATCH] pep8 changes --- doc/examples/plot_seam_carving.py | 6 +++--- skimage/transform/_seam_carving.pyx | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/examples/plot_seam_carving.py b/doc/examples/plot_seam_carving.py index c989f0c4..6c31fbb8 100644 --- a/doc/examples/plot_seam_carving.py +++ b/doc/examples/plot_seam_carving.py @@ -15,13 +15,13 @@ using the Sobel filter to signify the importance of each pixel. """ from skimage import io, data from skimage import transform -from skimage import color, filters +from skimage import filters from matplotlib import pyplot as plt img = data.coins() -out = transform.seam_carve(img, 'vertical', 80, energy_func = filters.sobel) -out = transform.seam_carve(out, 'horizontal', 70, energy_func = filters.sobel) +out = transform.seam_carve(img, 'vertical', 80, energy_func=filters.sobel) +out = transform.seam_carve(out, 'horizontal', 70, energy_func=filters.sobel) resized = transform.resize(img, out.shape) plt.title('Original Image') diff --git a/skimage/transform/_seam_carving.pyx b/skimage/transform/_seam_carving.pyx index b91887a5..3b83e08f 100644 --- a/skimage/transform/_seam_carving.pyx +++ b/skimage/transform/_seam_carving.pyx @@ -6,7 +6,7 @@ import numpy as np cimport numpy as cnp -cdef cnp.double_t ABSOLUTE_MAX = np.finfo(np.double).max +cdef cnp.double_t DBL_MAX = np.finfo(np.double).max cdef find_seam_v(cnp.double_t[:, ::1] energy_img, cnp.int8_t[:, ::1] track_img, @@ -22,10 +22,10 @@ cdef find_seam_v(cnp.double_t[:, ::1] energy_img, cnp.int8_t[:, ::1] track_img, track_img : (M, N) ndarray The image used to store the optimal decision made at each point while finding a minimum cost path. - current_cost : (N, ) ndarray + current_cost : (N,) ndarray An array to store the current cost of the optimal path for each column in row currently being processed. - prev_cost : (N, ) ndarray + prev_cost : (N,) ndarray An array to store the current cost of the optimal path for each column in row prior to the one being processed. cols : int @@ -35,7 +35,7 @@ cdef find_seam_v(cnp.double_t[:, ::1] energy_img, cnp.int8_t[:, ::1] track_img, Returns ------- - seam : (M, ) ndarray + seam : (M, ) ndarray of int An array containing the index of the row of the pixel to be removed for each column in the image. @@ -58,7 +58,7 @@ cdef find_seam_v(cnp.double_t[:, ::1] energy_img, cnp.int8_t[:, ::1] track_img, for row in range(1, rows): for col in range(0, cols): - min_cost = ABSOLUTE_MAX + min_cost = DBL_MAX for offset in range(-1, 2): idx = col + offset