4

OpenCV keeps random number generators in thread-local storage and reuses them between function calls. This can lead to inconsistent results between different call sequences.

In OpenCV 2.1, the variable tlsRNGKey is defined in cxrand.cpp and not exposed through the headers.

Am I missing something? I can't be the first person to need reproducible clustering results, can I?

1 Answer 1

5

You can do:

cv::theRNG().state = your_seed;
2
  • Andrey, this is interesting. Can it be added to OpenCV docs? I did not see it there.
    – Sam
    Mar 17, 2012 at 18:14
  • @vasile I think it is intentionally not documented because the field is specific for current multiply-with-carry implementation. Mar 18, 2012 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.