How to use cvRandInit() and cvRandState in opencv 2.4

asked 2017-04-24 01:22:07 -0600

mddrill gravatar image

updated 2017-04-24 01:41:52 -0600

Hi, I found some old code that uses OpenCV's C API. I'm trying to run it but the function cvRandInit() and the variable type CvRandState are not being recognized. Right now I'm only including opencv2/opencv.hpp. Is there another header file that I can use to access these older keywords? If not, are there newer functions that can be used to replace them?

Thank You!

edit retag flag offensive close merge delete

Comments

2

cvRandInit is in opencv 2.413 version but imho not in opencv 3.

cvRandState is RNG class and I think that cvRandInit is depreceated. You can use method fill or gaussian or uniform

LBerger gravatar imageLBerger ( 2017-04-24 01:26:14 -0600 )edit
1

Like @LBerger suggest, just remove old C code completely and replace it by their C++ variants. Else you will stumble into memory addressing issues when combining both interfaces. The RNG class is about everything that you will need I guess.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-04-24 08:25:36 -0600 )edit

@StevenPuttemans I want to run it once first to see if it's worth updating to C++, @LBerger, what method is fill gaussian or uniform? I cant find it in the documentation. Thanks

mddrill gravatar imagemddrill ( 2017-04-24 14:59:09 -0600 )edit

Running old code without updating ... just a bad habbit I guess :D

StevenPuttemans gravatar imageStevenPuttemans ( 2017-04-25 02:35:40 -0600 )edit