How to Check for Opencv on Ubuntu 9.10

How to check for openCV on Ubuntu 9.10

A proper answer to my own question !

pkg-config --modversion opencv

Find OpenCV Version Installed on Ubuntu

You can look at the headers or libs installed. pkg-config can tell you where they are:

pkg-config --cflags opencv
pkg-config --libs opencv

Alternatively you can write a simple program and print the following defs:

CV_MAJOR_VERSION
CV_MINOR_VERSION

A similar question has been also asked here:

Does OpenCv have a constant with its version number?

In addition to great @berak's answer (related to version.hpp):

There are different naming schemes in OpenCV 2.4 and OpenCV 3.0 branches.

For OpenCV 2.4.x we have something like this (note that for 2.4.x CV_VERSION_MAJOR is 4):

#define CV_VERSION_EPOCH    2
#define CV_VERSION_MAJOR 4
#define CV_VERSION_MINOR 8
#define CV_VERSION_REVISION 0

And for OpenCV 3.0.x we have the following (note that CV_VERSION_MAJOR sense was changed!):

#define CV_VERSION_MAJOR    3
#define CV_VERSION_MINOR 0
#define CV_VERSION_REVISION 0
#define CV_VERSION_STATUS "-dev"

That is if you need support for both 2.4.x abd 3.0.x, code will be slightly non-obvious if you want to check CV_VERSION_MAJOR.

I prefer checking CV_VERSION_EPOCH instead:

#if (defined(CV_VERSION_EPOCH) && CV_VERSION_EPOCH == 2)
# OpenCV 2.4.x stuff
#else
# OpenCV 3.0 stuff
#endif

How to get opencv include work in kubuntu? (Includes solution to how to include and link in netbeans 6.7.1)

"undefined reference to" is a linker error. You forgot to link your application against the OpenCV libraries. Make sure you link against cv and highgui (-lcv -lhighgui) or use the pkg-config call that Tobu provided. I'd also second the request for more detailed error messages.

Problem with cvCreateVideoWriter in OpenCv. Again )

I recompiled OpenCV and ffmpeg from source again and it seems to work fine right now.

cvCreateCameraCapture returns null

I'm using OpenCV 2.1 on Ubuntu 9.04 and this works fine:

CvCapture* capture = NULL;
if ((capture = cvCaptureFromCAM(-1)) == NULL)
{
std::cerr << "!!! ERROR: cvCaptureFromCAM No camera found\n";
return -1;
}

Note that I'm using cvCaptureFromCAM() instead of cvCreateCameraCapture().

How to make a shortcut/script that checks and toggles screen orientation in Ubuntu 9.10

Try the script mentioned at this blog post. If it works, just save it somewhere like /usr/local/bin/toggle_xrandr.sh (make sure you do chmod +x on it), and then create a new shortcut on your desktop or panel pointing to the script.



Related Topics



Leave a reply



Submit