samedi 21 juillet 2018

Explanation of the output of the multivariate randn

I would like to understand one thing: We suppose to have three variables (X, Y, Z) and we want to calculate the covariance matrix between them. We get a mean and a covariance. Now I want to generate samples from it, using the randn function. In the randn function, as stated in the documentation:

dst - output array of random numbers; the array must be pre-allocated and have 1 to 4 channels.

My vector dst must necessarily be set up as a 3-channel matrix to work. Should I set it this way because I have 3 variables (X, Y, Z)? And if I had more than 4 variables, like: X, Y, Z, W, R, T ... How could I do? This is the code I used:

cv::Mat dst = cv::Mat::zeros(2,2, CV_32FC3);
cv::theRNG().state = cv::getTickCount();
cv::randn(dst, mean, covar);




Aucun commentaire:

Enregistrer un commentaire