Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to add gaussian noise in all channels of an image with randn?

I'm not sure if I'm doing something wrong, but I have a strange kind of "misunderstanding" with opencv function (in python) for random number generation - randn() http://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html#randn

When I try to add gaussian noise to RGB image (adding normally distributed random numbers in "dst" matrix that has 3 channels), those random numbers get only distributed through one channel (the first one... blue). Other channels stay unchanged. I am implementing simple peace of code

cv2.randn(gauss, mean, sigma)

which with

bg, gg, rg = cv2.split(gauss)

shows that I haven't changed anything in gg and rg.

Am I doing something wrong?