c++opencvparticle-filter

Multivariate Gaussian Distribution in particle filter


While initialising the particles, i need to add some gaussian noise to it. For example

particle.x(i) = rect(1)+mgd(1,1,0,10);

here rect(1) gives the position, and mgd function is providing the noise

The details about the mgd function are:

My value of N and d are always 1, How can I implement the mgd function in opencv c++?


Solution

  • Take a look at standard library "random", it includes methods for different distributions, including normal distribution.

    In the case of uncorrelated variables, you can use independent 1D random number for each dimension (see KeillRandor's answer), otherwise it is not correct. For implementation you can look at MATLAB's code, to do it, type in script editor

    mvnrnd

    then right mouse click on just typed command and select open mvrnd in context menu. You'll see the MATLAB code for mvnrnd function.