Module Expr Str Import alias identifier Import alias identifier ImportFrom alias alias ImportFrom alias Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Num Num Slice Num Num Assign NameStore BinOpAdd NameLoad BinOpMult Num Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Num Assign NameStore Call NameLoad NameLoad Num Num Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr keyword Num keyword TupleLoad Num Num keyword NameLoad keyword NameLoad keyword Dict Str Str Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr
N/A N/A 
=================================================
Non-local means denoising for preserving textures
=================================================

In this example, we denoise a detail of the astronaut image using the non-local
means filter. The non-local means algorithm replaces the value of a pixel by an
average of a selection of other pixels values: small patches centered on the
other pixels are compared to the patch centered on the pixel of interest, and
the average is performed only for pixels that have patches close to the current
patch. As a result, this algorithm can restore well textures, that would be
blurred by other denoising algoritm.
 N/A numpy np N/A matplotlib.pyplot plt skimage data img_as_float skimage.restoration denoise_nl_means N/A astro N/A img_as_float N/A N/A data astronaut N/A astro N/A astro N/A N/A 30 180 N/A 150 300 N/A noisy N/A astro N/A 0.3 N/A N/A N/A np random random N/A astro shape N/A noisy N/A N/A np clip noisy 0 1 N/A denoise N/A denoise_nl_means noisy 7 9 0.08 N/A N/A fig ax N/A N/A plt subplots ncols 2 figsize N/A 8 4 sharex True sharey True subplot_kw N/A adjustable box-forced N/A N/A N/A N/A ax N/A 0 imshow noisy N/A N/A N/A N/A ax N/A 0 axis off N/A N/A N/A N/A ax N/A 0 set_title noisy N/A N/A N/A N/A ax N/A 1 imshow denoise N/A N/A N/A N/A ax N/A 1 axis off N/A N/A N/A N/A ax N/A 1 set_title non-local means N/A N/A N/A fig tight_layout N/A N/A N/A plt show