improve performance of equalize example

percentile can compute multiple ranks in one go which in the case of the
example halves the required time.
This commit is contained in:
Julian Taylor
2014-03-13 21:48:45 +01:00
parent 4992f8bc9b
commit d4cb154d17
2 changed files with 2 additions and 5 deletions
+1 -2
View File
@@ -60,8 +60,7 @@ def plot_img_and_hist(img, axes, bins=256):
img = data.moon()
# Contrast stretching
p2 = np.percentile(img, 2)
p98 = np.percentile(img, 98)
p2, p98 = np.percentile(img, (2, 98))
img_rescale = exposure.rescale_intensity(img, in_range=(p2, p98))
# Equalization