mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-12 05:45:22 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user