How to determine OpenCV version

2019-02-04 11:04发布

How to determine which version of OpenCV I have installed?

I am most interested in knowing a way of doing it programatically (and cross-platform), but I can't even find a way to determine the installed version from outside the code.

I'm working with C++03, on Fedora.

8条回答
beautiful°
2楼-- · 2019-02-04 11:49

if you are working under Windows and you need to configure Codeblocks or any other IDE (thus,you can not issue any command yet nor compile a program ) you can simply go to the folder of installation of OpenCV and look after the final leters of the libraries in the sub-folder "/lib" .All libraries there are named in a pattern that reflects the major,minor and the revision of the build of OpenCV.For instance if you stumble upon a file named opencv_ts300.lib or opencv_world300.lib then the major is 3,minor is 0 and revision is 0.

(Note: it's likely that this method fails I mean when these informations do not comply with the real version but this will be maybe with the revision but unlikely with the major)

查看更多
Rolldiameter
3楼-- · 2019-02-04 11:52

You can check the following macro variables:

CV_MAJOR_VERSION
CV_MINOR_VERSION
查看更多
仙女界的扛把子
4楼-- · 2019-02-04 11:55

If you install from svn repository, you can see the exact revision version like that:

# in the opencv.svn directory
svn info
查看更多
The star\"
5楼-- · 2019-02-04 11:59

If you also want to get build information, you can use this code:

    printf("OpenCV: %s", cv::getBuildInformation().c_str());
查看更多
贼婆χ
6楼-- · 2019-02-04 12:00

pkg-config --modversion opencv

查看更多
一夜七次
7楼-- · 2019-02-04 12:08

You can check the CV_VERSION macro.

查看更多
登录 后发表回答