Poisson noise #46

Open
opened 2024-04-09 03:57:04 +02:00 by Benjamin_Loison · 0 comments

Figure_1

import numpy as np
import matplotlib.pyplot as plt
from PIL import Image

image = np.array(Image.open('photo_benjamin_loison.jpg'))

_, axes = plt.subplots(4)
for peakIndex, PEAK in enumerate([0.1, 0.3, 0.7, 1]):
    noisy = np.random.poisson(image / 255.0 * PEAK) / PEAK * 255
    axes[peakIndex].imshow(noisy)

plt.show()
Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).
Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).
Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).
Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).

Based on the Stack Overflow answer 36331042.

![Figure_1](/attachments/1b27d775-f73c-47a2-958e-e9f49813fec8) ```py import numpy as np import matplotlib.pyplot as plt from PIL import Image image = np.array(Image.open('photo_benjamin_loison.jpg')) _, axes = plt.subplots(4) for peakIndex, PEAK in enumerate([0.1, 0.3, 0.7, 1]): noisy = np.random.poisson(image / 255.0 * PEAK) / PEAK * 255 axes[peakIndex].imshow(noisy) plt.show() ``` ``` Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers). Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers). Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers). Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers). ``` Based on [the Stack Overflow answer 36331042](https://stackoverflow.com/a/36331042).
Benjamin_Loison added the
low priority
quick
labels 2024-04-09 03:57:04 +02:00
Sign in to join this conversation.
No description provided.