OpenCV on ubuntu 11.10
Why don't you use pkg-config to your favor?
g++ hello.c -o hello `pkg-config --cflags --libs opencv`
How to install opencv in ubuntu 11.10?
- download latest OpenCV-2.4.2.tar.bz2 and extract it.
- in terminal
cd
to the Opencv-2.4.2 - run
mkdir release
- cd release
- run
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..
- run
sudo make install
That's it to install opencv. It will take almost 30 mins to install.
But after successful installation you might get another issue with your Ubuntu 11.10 (in my experience). You may get linking error with opencv libraries. To get rid of that problem run export LD_LIBRARY_PATH=/usr/local/lib
on every login session. Or add /usr/local/lib
-this line at end of /etc/ld.so.conf
for a permanent solution.
You can download my detailed opencv implementation of histogram equalization from my website for a good start-up!
my website :
opencv installation on ubuntu 11.10
For an error like this:
dpkg: error processing /var/cache/apt/archives/AAA (--unpack):
trying to overwrite `/usr/lib/BBB', which is also in package CCC
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
AAA
E: Sub-process /usr/bin/dpkg returned an error code (1)
(where AAA,BBB,CCC are placeholder names, in case it wasn’t clear)
do
sudo dpkg -i --force-overwrite AAA
(give full path of AAA), and then run
sudo apt-get -f install
again.
And also, try googling before posting a question cause there are tons of links explaining how to fix this error!
Error installing OpenCV 2.3.1 on Ubuntu 11.10
You have a problem with the FFMPEG. You need to recompile it with the --enable-shared option. That could probably do the deal for you.
Building OpenCV 2.3.1 with Python 2.7 support in Ubuntu 11.10 64bit
It looks like you're using an old install guide. Use BUILD_NEW_PYTHON_SUPPORT
instead.
So, execute CMake like this:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..
Also, if you use the CMake GUI, it is easier to see all of the options you can set for OpenCV (there are so many it's quite tedious to type them all on the command-line). To get it for Ubuntu, do this:
sudo apt-get install cmake-qt-gui
OpenCV-2.4.0,NetBeans7.0.1, Ubuntu11.10,undefined reference to `cv::Mat::zeros(int, int, int)
That function is defined inside libopencv_core.so
, so make sure you are linking to opencv_core
.
$ nm libopencv_core.so | c++filt | grep zeros
000db520 T cv::Mat::zeros(cv::Size_<int>, int)
000db330 T cv::Mat::zeros(int, int, int)
How to install OpenCV on Linux as regular user
In this case you would need to compile it yourself, it is explained here: http://opencv.willowgarage.com/wiki/InstallGuide
You simply download the tar.gz, then you extract it and goto that directory in a terminal.
When you've done this, you need to comfigure what you want and don't want first. You can do so by running either cmake or cmake-gui. Use cmake-gui, if you want a gui ;)
cmake-gui
in cmake-gui you needed to specify a directory where to put some files, go there in a terminal and run make.
make
After this you should search for a directory with your header-files (.h or .hpp) and one with your library-files (.a, .so and .o). Add the first to your INCLUDE_PATH directory and the second to your LD_LIBRARY_PATH variable ;)
That should do it. Please note that this is an 'in memory' explenation, as compiling opencv takes a long time, I did not try this myself. But feel free to comment if you still have questions. The best advice I would like to give you is use cmake-gui and see what options are available there. Good luck!
Related Topics
Specialization of 'Template<Class _Tp> Struct Std::Less' in Different Namespace
Free Function Versus Member Function
Why Implicit Conversion Is Harmful in C++
C++ Static_Cast Runtime Overhead
How to Use C++14 Features When Building Qmake Projects
How Could Comma Separated Initialization Such as in Eigen Be Possibly Implemented in C++
How to Tell Pyximport to Use the Cython --Cplus Option
Is It Safe to Reinterpret_Cast an Enum Class Variable to a Reference of the Underlying Type
How to Cin and Cout Some Unicode Text
How to Add Zlib to an Existing Qt Installation
Why Does the Compiler Choose Bool Over String for Implicit Typecast of L""
C++: Read from Text File and Separate into Variable
Read from Qtcpsocket Using Qdatastream