Skip to content

Commit

Permalink
Add a test that exposed the infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Oct 25, 2015
1 parent 8317bcf commit 7bea0c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion skimage/exposure/_adapthist.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def clip_histogram(hist, clip_limit):
hist[mid_mask] = clip_limit

iteration = 0
while n_excess > 0 and iteration < 256: # Redistribute remaining excess
while n_excess > 0 and iteration < 20: # Redistribute remaining excess
index = 0
while n_excess > 0 and index < hist.size:
under_mask = hist < 0
Expand Down
2 changes: 1 addition & 1 deletion skimage/exposure/tests/test_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_adapthist_grayscale():
img = np.dstack((img, img, img))
with expected_warnings(['precision loss|non-contiguous input',
'deprecated']):
adapted_old = exposure.equalize_adapthist(img, 10, 9, clip_limit=0.01,
adapted_old = exposure.equalize_adapthist(img, 10, 9, clip_limit=0.001,
nbins=128)
adapted = exposure.equalize_adapthist(img, kernel_size=(57, 51), clip_limit=0.01, nbins=128)
assert img.shape == adapted.shape
Expand Down

0 comments on commit 7bea0c1

Please sign in to comment.