<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> from skimage import img_as_ubyte <EOL> from skimage import data <EOL> noisy_image = img_as_ubyte ( data . camera ( ) ) <EOL> hist = np . histogram ( noisy_image , bins = np . arange ( <NUM_LIT:0> , <NUM_LIT> ) ) <EOL> fig , ( ax1 , ax2 ) = plt . subplots ( <NUM_LIT:1> , <NUM_LIT:2> , figsize = ( <NUM_LIT:8> , <NUM_LIT:3> ) ) <EOL> ax1 . imshow ( noisy_image , interpolation = '<STR_LIT>' , cmap = plt . cm . gray ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax2 . plot ( hist [ <NUM_LIT:1> ] [ : - <NUM_LIT:1> ] , hist [ <NUM_LIT:0> ] , lw = <NUM_LIT:2> ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage . filters . rank import median <EOL> from skimage . morphology import disk <EOL> noise = np . random . random ( noisy_image . shape ) <EOL> noisy_image = img_as_ubyte ( data . camera ( ) ) <EOL> noisy_image [ noise > <NUM_LIT> ] = <NUM_LIT:255> <EOL> noisy_image [ noise < <NUM_LIT> ] = <NUM_LIT:0> <EOL> fig , ax = plt . subplots ( <NUM_LIT:2> , <NUM_LIT:2> , figsize = ( <NUM_LIT:10> , <NUM_LIT:7> ) , sharex = True , sharey = True ) <EOL> ax1 , ax2 , ax3 , ax4 = ax . ravel ( ) <EOL> ax1 . imshow ( noisy_image , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:255> , cmap = plt . cm . gray ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax1 . set_adjustable ( '<STR_LIT>' ) <EOL> ax2 . imshow ( median ( noisy_image , disk ( <NUM_LIT:1> ) ) , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:255> , cmap = plt . cm . gray ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax2 . axis ( '<STR_LIT>' ) <EOL> ax2 . set_adjustable ( '<STR_LIT>' ) <EOL> ax3 . imshow ( median ( noisy_image , disk ( <NUM_LIT:5> ) ) , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:255> , cmap = plt . cm . gray ) <EOL> ax3 . set_title ( '<STR_LIT>' ) <EOL> ax3 . axis ( '<STR_LIT>' ) <EOL> ax3 . set_adjustable ( '<STR_LIT>' ) <EOL> ax4 . imshow ( median ( noisy_image , disk ( <NUM_LIT:20> ) ) , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:255> , cmap = plt . cm . gray ) <EOL> ax4 . set_title ( '<STR_LIT>' ) <EOL> ax4 . axis ( '<STR_LIT>' ) <EOL> ax4 . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage . filters . rank import mean <EOL> fig , ( ax1 , ax2 ) = plt . subplots ( <NUM_LIT:1> , <NUM_LIT:2> , figsize = [ <NUM_LIT:10> , <NUM_LIT:7> ] , sharex = True , sharey = True ) <EOL> loc_mean = mean ( noisy_image , disk ( <NUM_LIT:10> ) ) <EOL> ax1 . imshow ( noisy_image , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:255> , cmap = plt . cm . gray ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax1 . set_adjustable ( '<STR_LIT>' ) <EOL> ax2 . imshow ( loc_mean , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:255> , cmap = plt . cm . gray ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax2 . axis ( '<STR_LIT>' ) <EOL> ax2 . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage . filters . rank import mean_bilateral <EOL> noisy_image = img_as_ubyte ( data . camera ( ) ) <EOL> bilat = mean_bilateral ( noisy_image . astype ( np . uint16 ) , disk ( <NUM_LIT:20> ) , s0 = <NUM_LIT:10> , s1 = <NUM_LIT:10> ) <EOL> fig , ax = plt . subplots ( <NUM_LIT:2> , <NUM_LIT:2> , figsize = ( <NUM_LIT:10> , <NUM_LIT:7> ) , sharex = '<STR_LIT>' , sharey = '<STR_LIT>' ) <EOL> ax1 , ax2 , ax3 , ax4 = ax . ravel ( ) <EOL> ax1 . imshow ( noisy_image , cmap = plt . cm . gray ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax1 . set_adjustable ( '<STR_LIT>' ) <EOL> ax2 . imshow ( bilat , cmap = plt . cm . gray ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax2 . axis ( '<STR_LIT>' ) <EOL> ax2 . set_adjustable ( '<STR_LIT>' ) <EOL> ax3 . imshow ( noisy_image [ <NUM_LIT:200> : <NUM_LIT> , <NUM_LIT> : <NUM_LIT> ] , cmap = plt . cm . gray ) <EOL> ax3 . axis ( '<STR_LIT>' ) <EOL> ax3 . set_adjustable ( '<STR_LIT>' ) <EOL> ax4 . imshow ( bilat [ <NUM_LIT:200> : <NUM_LIT> , <NUM_LIT> : <NUM_LIT> ] , cmap = plt . cm . gray ) <EOL> ax4 . axis ( '<STR_LIT>' ) <EOL> ax4 . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage import exposure <EOL> from skimage . filters import rank <EOL> noisy_image = img_as_ubyte ( data . camera ( ) ) <EOL> glob = exposure . equalize_hist ( noisy_image ) * <NUM_LIT:255> <EOL> loc = rank . equalize ( noisy_image , disk ( <NUM_LIT:20> ) ) <EOL> hist = np . histogram ( noisy_image , bins = np . arange ( <NUM_LIT:0> , <NUM_LIT> ) ) <EOL> glob_hist = np . histogram ( glob , bins = np . arange ( <NUM_LIT:0> , <NUM_LIT> ) ) <EOL> loc_hist = np . histogram ( loc , bins = np . arange ( <NUM_LIT:0> , <NUM_LIT> ) ) <EOL> fig , ax = plt . subplots ( <NUM_LIT:3> , <NUM_LIT:2> , figsize = ( <NUM_LIT:10> , <NUM_LIT:10> ) ) <EOL> ax1 , ax2 , ax3 , ax4 , ax5 , ax6 = ax . ravel ( ) <EOL> ax1 . imshow ( noisy_image , interpolation = '<STR_LIT>' , cmap = plt . cm . gray ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax2 . plot ( hist [ <NUM_LIT:1> ] [ : - <NUM_LIT:1> ] , hist [ <NUM_LIT:0> ] , lw = <NUM_LIT:2> ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax3 . imshow ( glob , interpolation = '<STR_LIT>' , cmap = plt . cm . gray ) <EOL> ax3 . axis ( '<STR_LIT>' ) <EOL> ax4 . plot ( glob_hist [ <NUM_LIT:1> ] [ : - <NUM_LIT:1> ] , glob_hist [ <NUM_LIT:0> ] , lw = <NUM_LIT:2> ) <EOL> ax4 . set_title ( '<STR_LIT>' ) <EOL> ax5 . imshow ( loc , interpolation = '<STR_LIT>' , cmap = plt . cm . gray ) <EOL> ax5 . axis ( '<STR_LIT>' ) <EOL> ax6 . plot ( loc_hist [ <NUM_LIT:1> ] [ : - <NUM_LIT:1> ] , loc_hist [ <NUM_LIT:0> ] , lw = <NUM_LIT:2> ) <EOL> ax6 . set_title ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage . filters . rank import autolevel <EOL> noisy_image = img_as_ubyte ( data . camera ( ) ) <EOL> auto = autolevel ( noisy_image . astype ( np . uint16 ) , disk ( <NUM_LIT:20> ) ) <EOL> fig , ( ax1 , ax2 ) = plt . subplots ( <NUM_LIT:1> , <NUM_LIT:2> , figsize = [ <NUM_LIT:10> , <NUM_LIT:7> ] , sharex = True , sharey = True ) <EOL> ax1 . imshow ( noisy_image , cmap = plt . cm . gray ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax1 . set_adjustable ( '<STR_LIT>' ) <EOL> ax2 . imshow ( auto , cmap = plt . cm . gray ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax2 . axis ( '<STR_LIT>' ) <EOL> ax2 . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage . filters . rank import autolevel_percentile <EOL> image = data . camera ( ) <EOL> selem = disk ( <NUM_LIT:20> ) <EOL> loc_autolevel = autolevel ( image , selem = selem ) <EOL> loc_perc_autolevel0 = autolevel_percentile ( image , selem = selem , p0 = <NUM_LIT> , p1 = <NUM_LIT:1.0> ) <EOL> loc_perc_autolevel1 = autolevel_percentile ( image , selem = selem , p0 = <NUM_LIT> , p1 = <NUM_LIT> ) <EOL> loc_perc_autolevel2 = autolevel_percentile ( image , selem = selem , p0 = <NUM_LIT> , p1 = <NUM_LIT> ) <EOL> loc_perc_autolevel3 = autolevel_percentile ( image , selem = selem , p0 = <NUM_LIT> , p1 = <NUM_LIT> ) <EOL> fig , axes = plt . subplots ( nrows = <NUM_LIT:3> , ncols = <NUM_LIT:2> , figsize = ( <NUM_LIT:7> , <NUM_LIT:8> ) , sharex = True , sharey = True ) <EOL> ax0 , ax1 , ax2 = axes <EOL> plt . gray ( ) <EOL> title_list = [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> image_list = [ image , <EOL> loc_autolevel , <EOL> loc_perc_autolevel0 , <EOL> loc_perc_autolevel1 , <EOL> loc_perc_autolevel2 , <EOL> loc_perc_autolevel3 ] <EOL> axes_list = axes . ravel ( ) . tolist ( ) <EOL> for i in range ( <NUM_LIT:0> , len ( image_list ) ) : <EOL> axes_list [ i ] . imshow ( image_list [ i ] , cmap = plt . cm . gray , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:255> ) <EOL> axes_list [ i ] . set_title ( title_list [ i ] ) <EOL> axes_list [ i ] . axis ( '<STR_LIT>' ) <EOL> axes_list [ i ] . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage . filters . rank import enhance_contrast <EOL> noisy_image = img_as_ubyte ( data . camera ( ) ) <EOL> enh = enhance_contrast ( noisy_image , disk ( <NUM_LIT:5> ) ) <EOL> fig , ax = plt . subplots ( <NUM_LIT:2> , <NUM_LIT:2> , figsize = [ <NUM_LIT:10> , <NUM_LIT:7> ] , sharex = '<STR_LIT>' , sharey = '<STR_LIT>' ) <EOL> ax1 , ax2 , ax3 , ax4 = ax . ravel ( ) <EOL> ax1 . imshow ( noisy_image , cmap = plt . cm . gray ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax1 . set_adjustable ( '<STR_LIT>' ) <EOL> ax2 . imshow ( enh , cmap = plt . cm . gray ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax2 . axis ( '<STR_LIT>' ) <EOL> ax2 . set_adjustable ( '<STR_LIT>' ) <EOL> ax3 . imshow ( noisy_image [ <NUM_LIT:200> : <NUM_LIT> , <NUM_LIT> : <NUM_LIT> ] , cmap = plt . cm . gray ) <EOL> ax3 . axis ( '<STR_LIT>' ) <EOL> ax3 . set_adjustable ( '<STR_LIT>' ) <EOL> ax4 . imshow ( enh [ <NUM_LIT:200> : <NUM_LIT> , <NUM_LIT> : <NUM_LIT> ] , cmap = plt . cm . gray ) <EOL> ax4 . axis ( '<STR_LIT>' ) <EOL> ax4 . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage . filters . rank import enhance_contrast_percentile <EOL> noisy_image = img_as_ubyte ( data . camera ( ) ) <EOL> penh = enhance_contrast_percentile ( noisy_image , disk ( <NUM_LIT:5> ) , p0 = <NUM_LIT> , p1 = <NUM_LIT> ) <EOL> fig , ax = plt . subplots ( <NUM_LIT:2> , <NUM_LIT:2> , figsize = [ <NUM_LIT:10> , <NUM_LIT:7> ] , sharex = '<STR_LIT>' , sharey = '<STR_LIT>' ) <EOL> ax1 , ax2 , ax3 , ax4 = ax . ravel ( ) <EOL> ax1 . imshow ( noisy_image , cmap = plt . cm . gray ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax2 . imshow ( penh , cmap = plt . cm . gray ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax3 . imshow ( noisy_image [ <NUM_LIT:200> : <NUM_LIT> , <NUM_LIT> : <NUM_LIT> ] , cmap = plt . cm . gray ) <EOL> ax4 . imshow ( penh [ <NUM_LIT:200> : <NUM_LIT> , <NUM_LIT> : <NUM_LIT> ] , cmap = plt . cm . gray ) <EOL> for ax in ax . ravel ( ) : <EOL> ax . axis ( '<STR_LIT>' ) <EOL> ax . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage . filters . rank import otsu <EOL> from skimage . filters import threshold_otsu <EOL> p8 = data . page ( ) <EOL> radius = <NUM_LIT:10> <EOL> selem = disk ( radius ) <EOL> t_loc_otsu = otsu ( p8 , selem ) <EOL> loc_otsu = p8 >= t_loc_otsu <EOL> t_glob_otsu = threshold_otsu ( p8 ) <EOL> glob_otsu = p8 >= t_glob_otsu <EOL> fig , ax = plt . subplots ( <NUM_LIT:2> , <NUM_LIT:2> , sharex = True , sharey = True ) <EOL> ax1 , ax2 , ax3 , ax4 = ax . ravel ( ) <EOL> fig . colorbar ( ax1 . imshow ( p8 , cmap = plt . cm . gray ) , ax = ax1 ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> fig . colorbar ( ax2 . imshow ( t_loc_otsu , cmap = plt . cm . gray ) , ax = ax2 ) <EOL> ax2 . set_title ( '<STR_LIT>' % radius ) <EOL> ax3 . imshow ( p8 >= t_loc_otsu , cmap = plt . cm . gray ) <EOL> ax3 . set_title ( '<STR_LIT>' % t_glob_otsu ) <EOL> ax4 . imshow ( glob_otsu , cmap = plt . cm . gray ) <EOL> ax4 . set_title ( '<STR_LIT>' % t_glob_otsu ) <EOL> for ax in ax . ravel ( ) : <EOL> ax . axis ( '<STR_LIT>' ) <EOL> ax . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> n = <NUM_LIT:100> <EOL> theta = np . linspace ( <NUM_LIT:0> , <NUM_LIT:10> * np . pi , n ) <EOL> x = np . sin ( theta ) <EOL> m = ( np . tile ( x , ( n , <NUM_LIT:1> ) ) * np . linspace ( <NUM_LIT:0.1> , <NUM_LIT:1> , n ) * <NUM_LIT> + <NUM_LIT> ) . astype ( np . uint8 ) <EOL> radius = <NUM_LIT:10> <EOL> t = rank . otsu ( m , disk ( radius ) ) <EOL> fig , ( ax1 , ax2 ) = plt . subplots ( <NUM_LIT:1> , <NUM_LIT:2> , sharex = True , sharey = True ) <EOL> ax1 . imshow ( m ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax1 . set_adjustable ( '<STR_LIT>' ) <EOL> ax2 . imshow ( m >= t , interpolation = '<STR_LIT>' ) <EOL> ax2 . set_title ( '<STR_LIT>' % radius ) <EOL> ax2 . axis ( '<STR_LIT>' ) <EOL> ax2 . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage . filters . rank import maximum , minimum , gradient <EOL> noisy_image = img_as_ubyte ( data . camera ( ) ) <EOL> closing = maximum ( minimum ( noisy_image , disk ( <NUM_LIT:5> ) ) , disk ( <NUM_LIT:5> ) ) <EOL> opening = minimum ( maximum ( noisy_image , disk ( <NUM_LIT:5> ) ) , disk ( <NUM_LIT:5> ) ) <EOL> grad = gradient ( noisy_image , disk ( <NUM_LIT:5> ) ) <EOL> fig , ax = plt . subplots ( <NUM_LIT:2> , <NUM_LIT:2> , figsize = [ <NUM_LIT:10> , <NUM_LIT:7> ] , sharex = True , sharey = True ) <EOL> ax1 , ax2 , ax3 , ax4 = ax . ravel ( ) <EOL> ax1 . imshow ( noisy_image , cmap = plt . cm . gray ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax2 . imshow ( closing , cmap = plt . cm . gray ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax3 . imshow ( opening , cmap = plt . cm . gray ) <EOL> ax3 . set_title ( '<STR_LIT>' ) <EOL> ax4 . imshow ( grad , cmap = plt . cm . gray ) <EOL> ax4 . set_title ( '<STR_LIT>' ) <EOL> for ax in ax . ravel ( ) : <EOL> ax . axis ( '<STR_LIT>' ) <EOL> ax . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from skimage import data <EOL> from skimage . filters . rank import entropy <EOL> from skimage . morphology import disk <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> image = data . camera ( ) <EOL> fig , ( ax1 , ax2 ) = plt . subplots ( <NUM_LIT:1> , <NUM_LIT:2> , figsize = ( <NUM_LIT:10> , <NUM_LIT:4> ) , sharex = True , sharey = True ) <EOL> fig . colorbar ( ax1 . imshow ( image , cmap = plt . cm . gray ) , ax = ax1 ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax1 . set_adjustable ( '<STR_LIT>' ) <EOL> fig . colorbar ( ax2 . imshow ( entropy ( image , disk ( <NUM_LIT:5> ) ) , cmap = plt . cm . gray ) , ax = ax2 ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax2 . axis ( '<STR_LIT>' ) <EOL> ax2 . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> from time import time <EOL> from scipy . ndimage import percentile_filter <EOL> from skimage . morphology import dilation <EOL> from skimage . filters . rank import median , maximum <EOL> def exec_and_timeit ( func ) : <EOL> """<STR_LIT>""" <EOL> def wrapper ( * arg ) : <EOL> t1 = time ( ) <EOL> res = func ( * arg ) <EOL> t2 = time ( ) <EOL> ms = ( t2 - t1 ) * <NUM_LIT> <EOL> return ( res , ms ) <EOL> return wrapper <EOL> @ exec_and_timeit <EOL> def cr_med ( image , selem ) : <EOL> return median ( image = image , selem = selem ) <EOL> @ exec_and_timeit <EOL> def cr_max ( image , selem ) : <EOL> return maximum ( image = image , selem = selem ) <EOL> @ exec_and_timeit <EOL> def cm_dil ( image , selem ) : <EOL> return dilation ( image = image , selem = selem ) <EOL> @ exec_and_timeit <EOL> def ndi_med ( image , n ) : <EOL> return percentile_filter ( image , <NUM_LIT:50> , size = n * <NUM_LIT:2> - <NUM_LIT:1> ) <EOL> """<STR_LIT>""" <EOL> a = data . camera ( ) <EOL> rec = [ ] <EOL> e_range = range ( <NUM_LIT:1> , <NUM_LIT:20> , <NUM_LIT:2> ) <EOL> for r in e_range : <EOL> elem = disk ( r + <NUM_LIT:1> ) <EOL> rc , ms_rc = cr_max ( a , elem ) <EOL> rcm , ms_rcm = cm_dil ( a , elem ) <EOL> rec . append ( ( ms_rc , ms_rcm ) ) <EOL> rec = np . asarray ( rec ) <EOL> fig , ax = plt . subplots ( ) <EOL> ax . set_title ( '<STR_LIT>' ) <EOL> ax . set_ylabel ( '<STR_LIT>' ) <EOL> ax . set_xlabel ( '<STR_LIT>' ) <EOL> ax . plot ( e_range , rec ) <EOL> ax . legend ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> """<STR_LIT>""" <EOL> r = <NUM_LIT:9> <EOL> elem = disk ( r + <NUM_LIT:1> ) <EOL> rec = [ ] <EOL> s_range = range ( <NUM_LIT:100> , <NUM_LIT:1000> , <NUM_LIT:100> ) <EOL> for s in s_range : <EOL> a = ( np . random . random ( ( s , s ) ) * <NUM_LIT> ) . astype ( np . uint8 ) <EOL> ( rc , ms_rc ) = cr_max ( a , elem ) <EOL> ( rcm , ms_rcm ) = cm_dil ( a , elem ) <EOL> rec . append ( ( ms_rc , ms_rcm ) ) <EOL> rec = np . asarray ( rec ) <EOL> fig , ax = plt . subplots ( ) <EOL> ax . set_title ( '<STR_LIT>' ) <EOL> ax . set_ylabel ( '<STR_LIT>' ) <EOL> ax . set_xlabel ( '<STR_LIT>' ) <EOL> ax . plot ( s_range , rec ) <EOL> ax . legend ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> """<STR_LIT>""" <EOL> a = data . camera ( ) <EOL> rec = [ ] <EOL> e_range = range ( <NUM_LIT:2> , <NUM_LIT:30> , <NUM_LIT:4> ) <EOL> for r in e_range : <EOL> elem = disk ( r + <NUM_LIT:1> ) <EOL> rc , ms_rc = cr_med ( a , elem ) <EOL> rndi , ms_ndi = ndi_med ( a , r ) <EOL> rec . append ( ( ms_rc , ms_ndi ) ) <EOL> rec = np . asarray ( rec ) <EOL> fig , ax = plt . subplots ( ) <EOL> ax . set_title ( '<STR_LIT>' ) <EOL> ax . plot ( e_range , rec ) <EOL> ax . legend ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> ax . set_ylabel ( '<STR_LIT>' ) <EOL> ax . set_xlabel ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> fig , ( ax0 , ax1 ) = plt . subplots ( ncols = <NUM_LIT:2> , sharex = True , sharey = True ) <EOL> ax0 . set_title ( '<STR_LIT>' ) <EOL> ax0 . imshow ( rc ) <EOL> ax0 . axis ( '<STR_LIT>' ) <EOL> ax0 . set_adjustable ( '<STR_LIT>' ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . imshow ( rndi ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax1 . set_adjustable ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> r = <NUM_LIT:9> <EOL> elem = disk ( r + <NUM_LIT:1> ) <EOL> rec = [ ] <EOL> s_range = [ <NUM_LIT:100> , <NUM_LIT:200> , <NUM_LIT> , <NUM_LIT:1000> ] <EOL> for s in s_range : <EOL> a = ( np . random . random ( ( s , s ) ) * <NUM_LIT> ) . astype ( np . uint8 ) <EOL> ( rc , ms_rc ) = cr_med ( a , elem ) <EOL> rndi , ms_ndi = ndi_med ( a , r ) <EOL> rec . append ( ( ms_rc , ms_ndi ) ) <EOL> rec = np . asarray ( rec ) <EOL> fig , ax = plt . subplots ( ) <EOL> ax . set_title ( '<STR_LIT>' ) <EOL> ax . plot ( s_range , rec ) <EOL> ax . legend ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> ax . set_ylabel ( '<STR_LIT>' ) <EOL> ax . set_xlabel ( '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> plt . show ( ) </s>
