<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> from skimage import data , img_as_float <EOL> from skimage . measure import compare_ssim as ssim <EOL> img = img_as_float ( data . camera ( ) ) <EOL> rows , cols = img . shape <EOL> noise = np . ones_like ( img ) * <NUM_LIT> * ( img . max ( ) - img . min ( ) ) <EOL> noise [ np . random . random ( size = noise . shape ) > <NUM_LIT:0.5> ] *= - <NUM_LIT:1> <EOL> def mse ( x , y ) : <EOL> return np . linalg . norm ( x - y ) <EOL> img_noise = img + noise <EOL> img_const = img + abs ( noise ) <EOL> fig , ( ax0 , ax1 , ax2 ) = plt . subplots ( nrows = <NUM_LIT:1> , ncols = <NUM_LIT:3> , figsize = ( <NUM_LIT:16> , <NUM_LIT:6> ) , <EOL> sharex = True , sharey = True , <EOL> subplot_kw = { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> plt . tight_layout ( ) <EOL> mse_none = mse ( img , img ) <EOL> ssim_none = ssim ( img , img , dynamic_range = img . max ( ) - img . min ( ) ) <EOL> mse_noise = mse ( img , img_noise ) <EOL> ssim_noise = ssim ( img , img_noise , <EOL> dynamic_range = img_const . max ( ) - img_const . min ( ) ) <EOL> mse_const = mse ( img , img_const ) <EOL> ssim_const = ssim ( img , img_const , <EOL> dynamic_range = img_noise . max ( ) - img_noise . min ( ) ) <EOL> label = '<STR_LIT>' <EOL> ax0 . imshow ( img , cmap = plt . cm . gray , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:1> ) <EOL> ax0 . set_xlabel ( label % ( mse_none , ssim_none ) ) <EOL> ax0 . set_title ( '<STR_LIT>' ) <EOL> ax0 . axes . get_yaxis ( ) . set_visible ( False ) <EOL> ax1 . imshow ( img_noise , cmap = plt . cm . gray , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:1> ) <EOL> ax1 . set_xlabel ( label % ( mse_noise , ssim_noise ) ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . axes . get_yaxis ( ) . set_visible ( False ) <EOL> ax2 . imshow ( img_const , cmap = plt . cm . gray , vmin = <NUM_LIT:0> , vmax = <NUM_LIT:1> ) <EOL> ax2 . set_xlabel ( label % ( mse_const , ssim_const ) ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax2 . axes . get_yaxis ( ) . set_visible ( False ) <EOL> plt . show ( ) </s>
