开发者

How to check for openCV on Ubuntu 9.10

开发者 https://www.devze.com 2022-12-22 09:20 出处:网络
How can I confirm if openCV is properly installed in my c开发者_如何学JAVAomputer ? Is there any quick command line for it ? I am on Ubuntu 9.10 A proper answer to my own question !

How can I confirm if openCV is properly installed in my c开发者_如何学JAVAomputer ? Is there any quick command line for it ? I am on Ubuntu 9.10


A proper answer to my own question !

pkg-config --modversion opencv


With 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.

Example of '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


Here's an easy way to check. Assuming you installed using the default configuration.

In /usr/local/lib you should have the following libraries

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/opencv you should have the following header files.

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.


Here is c++ version

// 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;
}


Open your terminal and type this command: python3 -c "import cv2; print(cv2.__version__)"

This works on my system


I found this to be the simplest way:

/usr/bin/opencv_version


You could use dpkg.

$ dpkg -l | grep libopencv

Or if you use python version:

$ python
>>>> import cv2
0

精彩评论

暂无评论...
验证码 换一张
取 消