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
Where Is the Stack Memory Allocated from for a Linux Process
How to Find Words from One File in Another File
Selecting a Linux I/O Scheduler
Is \D Not Supported by Grep's Basic Expressions
How to Read Websocket Response in Linux Shell
How to Enable Bash in Windows 10 Developer Preview
How to Convert Pptx Files to Jpg or Png (For Each Slide) on Linux
Concatenating Two String Variables in Bash Appending Newline
How to Install Apxs Module on Apache 2.4.6
Minimizing Copies When Writing Large Data to a Socket
Assigning Dynamic Bash Variable Names Using a for Loop Seq
How to Pass Shell Variables as Command Line Argument to a Shell Script
How to List Running Screen Sessions
Portable Way to Get File Size (In Bytes) in the Shell
Add Text to File at Certain Line in Linux
Find and Basename Not Playing Nicely