def test_adapthist_color():
 img = skimage.img_as_uint(data.astronaut())
 with warnings.catch_warnings(record=True) as w:
  warnings.simplefilter('always')
  (hist, bin_centers) = exposure.histogram(img)
  assert (len(w) > 0)
 with expected_warnings(['precision loss']):
  adapted = exposure.equalize_adapthist(img, clip_limit=0.01)
 assert (adapted.min() == 0)
 assert (adapted.max() == 1.0)
 assert (img.shape == adapted.shape)
 full_scale = skimage.exposure.rescale_intensity(img)
 assert_almost_equal(peak_snr(full_scale, adapted), 109.393, 1)
 assert_almost_equal(norm_brightness_err(full_scale, adapted), 0.02, 2)
 return (data, adapted)

def test_adapthist_color ( ) : img = skimage . img_as_uint ( data . astronaut ( ) ) with warnings . catch_warnings ( record = True ) as w : warnings . simplefilter ( 'always' ) ( hist , bin_centers ) = exposure . histogram ( img ) assert ( len ( w ) > 0 ) with expected_warnings ( [ 'precision loss' ] ) : adapted = exposure . equalize_adapthist ( img , clip_limit = 0.01 ) assert ( adapted . min ( ) == 0 ) assert ( adapted . max ( ) == 1.0 ) assert ( img . shape == adapted . shape ) full_scale = skimage . exposure . rescale_intensity ( img ) assert_almost_equal ( peak_snr ( full_scale , adapted ) , 109.393 , 1 ) assert_almost_equal ( norm_brightness_err ( full_scale , adapted ) , 0.02 , 2 ) return ( data , adapted )
test an rgb color uint16 image .