Linux 如何在 Ubuntu 9.10 上检查 openCV
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2422514/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to check for openCV on Ubuntu 9.10
提问by Arkapravo
How can I confirm if openCV is properly installed in my computer ? Is there any quick command line for it ? I am on Ubuntu 9.10
如何确认我的计算机中是否正确安装了 openCV?是否有任何快速命令行?我在 Ubuntu 9.10
采纳答案by Arkapravo
A proper answer to my own question !
正确回答我自己的问题!
pkg-config --modversion opencv
pkg-config --modversion opencv
回答by Sunny
Here's an easy way to check. Assuming you installed using the default configuration.
这是一个简单的检查方法。假设您使用默认配置进行安装。
In /usr/local/libyou should have the following libraries
在/usr/local/lib你应该有以下库
libcvaux.so -> libcvaux.so.2.0
libcvaux.so.2.0 -> libcvaux.so.2.0.0
libcvaux.so.2.0.0
libcv.so -> libcv.so.2.0
libcv.so.2.0 -> libcv.so.2.0.0
libcv.so.2.0.0
libcxcore.so -> libcxcore.so.2.0
libcxcore.so.2.0 -> libcxcore.so.2.0.0
libcxcore.so.2.0.0
libhighgui.so -> libhighgui.so.2.0
libhighgui.so.2.0 -> libhighgui.so.2.0.0
libhighgui.so.2.0.0
libml.so -> libml.so.2.0
libml.so.2.0 -> libml.so.2.0.0
libml.so.2.0.0
And in /usr/local/include/opencvyou should have the following header files.
并且/usr/local/include/opencv你应该有以下头文件。
cvaux.h, cvcompat.h, cv.hpp, cvver.h, cvwimage.h, cxcore.hpp, cxflann.h,
cxmisc.h, cxtypes.h, highgui.hpp, cvaux.hpp, cv.h, cvtypes.h, cvvidsurv.hpp,
cxcore.h, cxerror.h, cxmat.hpp, cxoperations.hpp, highgui.h, ml.h
I'm assuming that you using the latest version which is 2.0.
我假设您使用的是最新版本 2.0。
回答by ssinfod
With OpenCV 2.4.x:
使用 OpenCV 2.4.x:
You can use "CV_VERSION" or "CV_MAJOR_VERSION", "CV_MINOR_VERSION", "CV_SUBMINOR_VERSION" from a C/C++ simple program.
您可以从 C/C++ 简单程序中使用“CV_VERSION”或“CV_MAJOR_VERSION”、“CV_MINOR_VERSION”、“CV_SUBMINOR_VERSION”。
Example of 'main.c':
“main.c”的示例:
#include <stdio.h>
#include <cv.h>
int main(void)
{
printf("%s\r\n", CV_VERSION);
printf("%u.%u.%u\r\n", CV_MAJOR_VERSION, CV_MINOR_VERSION, CV_SUBMINOR_VERSION);
}
Here is the compilation line:
这是编译行:
g++ `pkg-config --cflags opencv` main.c `pkg-config --libs opencv` -o main
回答by Adam
Here is c++ version
这是 C++ 版本
// https://www.solarianprogrammer.com/2014/04/21/opencv-beaglebone- black-ubuntu/
// Test to check the OpenCV version
// Build on Linux with:
// g++ test_1.cpp -o test_1 -lopencv_core
#include <opencv2/opencv.hpp>
#include <iostream>
int main() {
std::cout << "Hello, OpenCV version "<< CV_VERSION << std::endl;
return 0;
}
回答by DankMasterDan
I found this to be the simplest way:
我发现这是最简单的方法:
/usr/bin/opencv_version
/usr/bin/opencv_version
回答by techkuz
You could use dpkg.
你可以使用dpkg.
$ dpkg -l | grep libopencv
$ dpkg -l | grep libopencv
Or if you use python version:
或者,如果您使用 python 版本:
$ python
>>>> import cv2
回答by Naman Lazarus
Open your terminal and type this command:
python3 -c "import cv2; print(cv2.__version__)"
打开终端并输入以下命令:
python3 -c "import cv2; print(cv2.__version__)"
This works on my system
这适用于我的系统

