View the step-by-step solution to:

Question

Screen Shot 2019-10-15 at 1.40.57 AM.pngWhy does this code not work

where the noise occurs in small, horizontal lines. 

Screen Shot 2019-10-15 at 1.40.57 AM.png

A 1 from skimage import data, io
A
2 from scipy import ndimage
3 import numpy as np
4 import skimage as ski
5
6 # Load in the test image
7 a=io. imread ("a_noise. png", \
8
as_gray=True)
9 a=ski. ing_as_float64(a)
10 a*=1/ (a [: ] . max () )
11
12 # Initialize a copy of the image
13 (y, x)=a . shape
14 b=np. copy (a)
15
16
17 for j in range(1, y-1):
18
for i in range(1, x-1) :
19
20
# Create list of nearby points
21
1=[a[j, i] , a[j+1, i] , a[j-1, i] , a[j, i-1], a[j, i+1]]
22
23
# Set output pixel to be median
24
# of the list
25
b[j , i]=np. median( 1)
26
27
28
29 # Plot the image
30 io. imsave("a_denoise. png" , b)
31 |

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes