we now add the salt (which means some values will be almost whiteand pepper noise (which means some values will be almost black)lenna mh stretch(lennalenna np maximum(salt* seplenna np minimum(pepper* lenna*(~pepper)lennawe used the values and as white and black this is slightly smoother than the more extreme choices of and howeverall of these are choices that need to be made by subjective preferences and style putting the center in focus the final example shows how to mix numpy operators with tiny bit of filtering to get an interesting result we start with the lenna image and split it into the color channelsim mh imread('lenna jpg' , , im transpose( , ,