1 | initial version |
This is really a C++ question, no OpenCV needed. I mean, there's the example on the page you linked to that does exactly what you want.
But OpenCV does have an RNG class so here's how to use that. The mean is 0, the sigma is a parameter to the gaussian function.
cv::RNG rng(cv::getCPUTickCount());
double random = rng.gaussian(sigma);