opencv installation in ubuntu 11.10

Asked by vivek mittal

i am getting the error while using the make command ............................
THESE ARE THE STEPS I HAVE FOLLOWED ....................................

1)installing per-requisites

sudo apt-get install build-essential

sudo apt-get install cmake

sudo apt-get install pkg-config

sudo apt-get install libpng12-0 libpng12-dev libpng++-dev libpng3

sudo apt-get install libpnglite-dev libpngwriter0-dev libpngwriter0c2

sudo apt-get install zlib1g-dbg zlib1g zlib1g-dev

sudo apt-get install libjasper-dev libjasper-runtime libjasper1

sudo apt-get install pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools

sudo apt-get install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-prog

sudo apt-get install ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev

sudo apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev

sudo apt-get install libxine1-ffmpeg libxine-dev libxine1-bin

sudo apt-get install libunicap2 libunicap2-dev

sudo apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils

sudo apt-get install swig

sudo apt-get install libv4l-0 libv4l-dev

sudo apt-get install python-numpy

sudo apt-get install build-essential libgtk2.0-dev libjpeg62-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev

2)Install the python development headers

sudo apt-get install python-dev

3)Download the source code:
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3/

4)Go to the directory where OpenCV is downloaded via the terminal only and then un zip the package:
(note:- It is recommended that you move the downloaded OpenCV package to the home/<user> directory

tar -xvf OpenCV-2.3.1a.tar.bz2

cd OpenCV-2.3.1/

5)Now make a new directory called build and go in to it
mkdir build
cd build

6)Run Cmake

cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..

7)Now make

make

8) Make it permanent

sudo make install

9)Configuring OpenCV for using shared libraries:

sudo gedit /etc/ld.so.conf.d/opencv.conf

Add the following line at the end of the file (it may be an empty file, that is ok) and then save it:

/usr/local/lib

Close the file and run the following command to configure the library:

sudo ldconfig

OR RUN : export LD_LIBRARY_PATH=/usr/local/lib
10)Open your .bashrc file and add the following:
gedit .bashrc

sudo gedit /etc/bash.bashrc

add the following at the end of the file -

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

Save and close the file

11) Reboot the system

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu opencv Edit question
Assignee:
No assignee Edit question
Solved by:
vivek mittal
Solved:
Last query:
Last reply:
Revision history for this message
vivek mittal (viv-mttl) said :
#1

 [ 0%] Built target opencv_imgproc_pch_dephelp
[ 1%] Built target pch_Generate_opencv_imgproc
[ 2%] Built target opencv_core_pch_dephelp
[ 2%] Built target pch_Generate_opencv_core
[ 5%] Built target opencv_core
[ 13%] Built target opencv_imgproc
[ 14%] Built target opencv_calib3d_pch_dephelp
[ 14%] Built target pch_Generate_opencv_calib3d
[ 15%] Built target opencv_features2d_pch_dephelp
[ 15%] Built target pch_Generate_opencv_features2d
[ 16%] Built target opencv_flann_pch_dephelp
[ 17%] Built target pch_Generate_opencv_flann
[ 17%] Built target opencv_flann
[ 17%] Built target opencv_highgui_pch_dephelp
[ 17%] Built target pch_Generate_opencv_highgui
[ 17%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.o
In file included from /home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::reopen()’:
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:486:5: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1050) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:486:52: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1050) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:494:5: warning: ‘int avcodec_thread_init(AVCodecContext*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3612) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:494:50: warning: ‘int avcodec_thread_init(AVCodecContext*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3612) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:497:5: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3650) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:497:28: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3650) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::open(const char*)’:
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:524:15: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1050) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:524:63: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1050) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:541:9: warning: ‘int avcodec_thread_init(AVCodecContext*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3612) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:541:54: warning: ‘int avcodec_thread_init(AVCodecContext*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3612) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:547:13: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:550:13: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3650) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:550:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3650) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::grabFrame()’:
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:640:34: error: ‘avcodec_decode_video’ was not declared in this scope
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘const char* icvFFMPEGErrStr(int)’:
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:917:10: error: ‘AVERROR_NUMEXPECTED’ was not declared in this scope
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:921:10: error: ‘AVERROR_NOFMT’ was not declared in this scope
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:923:10: error: ‘AVERROR_IO’ was not declared in this scope
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:925:10: error: ‘AVERROR_NOMEM’ was not declared in this scope
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, CodecID, int, int, int, double, int)’:
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1012:70: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope
In file included from /home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘void CvVideoWriter_FFMPEG::close()’:
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1298:3: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/include/libavformat/avio.h:279) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1298:20: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/include/libavformat/avio.h:279) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)’:
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1339:41: error: ‘guess_format’ was not declared in this scope
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1367:31: error: ‘av_alloc_format_context’ was not declared in this scope
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1411:9: warning: ‘int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1363) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1411:35: warning: ‘int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1363) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1415:5: warning: ‘void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1485) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1415:35: warning: ‘void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1485) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1442:15: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3650) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1442:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3650) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1479:13: warning: ‘int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avio.h:278) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1479:52: warning: ‘int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avio.h:278) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1485:5: warning: ‘int av_write_header(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1421) [-Wdeprecated-declarations]
/home/uni/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1485:25: warning: ‘int av_write_header(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1421) [-Wdeprecated-declarations]
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

check this youtube page which i am using as a guide to my installation
...........................................................................................................................
http://www.youtube.com/watch?v=b3IQyhJXK78

thnx in advance for any help ........................

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

https://launchpad.net/~gijzelaar/+archive/opencv2.3

Does that not help / make it easier?

Revision history for this message
mycae (mycae) said :
#3

I have used OpenCV, but am not a fan - I eventually ported code away from opencv.

It is quite out of date in terms of video and image support, and is not well maintained, as you have discovered.

Depending upon your needs, you might also want to look at libmagick/libmagick++, or cimg (http://cimg.sourceforge.net/).

Revision history for this message
vivek mittal (viv-mttl) said :
#4

@mycae - thnx for the link and alternative ,, but still if u get solution to this particular problem then it will be more helpful for me .....
thnx and regards

Revision history for this message
MZ (zmz945) said :
#5

I have the exact same problem. If you were able to solve it, please shed a light. Thanks!

Revision history for this message
vivek mittal (viv-mttl) said :
#6

sorry MZ i am yet not able to solve the problem ......thnx and regards

On Sat, Feb 18, 2012 at 8:20 PM, MZ <email address hidden>wrote:

> Your question #186872 on opencv in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/opencv/+question/186872
>
> MZ posted a new comment:
> I have the exact same problem. If you were able to solve it, please shed
> a light. Thanks!
>
> --
> You received this question notification because you asked the question
>

Revision history for this message
MZ (zmz945) said :
#7

I was able to resolve the same problem and got OpenCV successfully installed today.

The problem was that OpenCV 2.3.1 isn't compatible with ffmpeg 0.8.x on Ubuntu 11.10 for some reason, so I downloaded ffmpeg 0.7.11, and then sudo apt-get remove ffmpeg x264, and reinstalled ffmpeg and x264. I also used the --enable-pic and --enable-shared flags for both, seeing on other posts that some people had problem when these aren't set.

Then I removed the original build directory I created in the OpenCV directory, recreated a new build directory, because some of the previous builds interfere with cmake, that later cmakes doesn't look at the libs it found in previous builds, like ffmpeg, so it doesn't know that you reinstalled a new version. (I ran it many times with failures before I saw that and deleted the whole build directory and restarted a new one).

In the new build directory, I reran cmake, now it saw the new ffmpeg, and then ran make, and it just ran all the way to 100%.

(If it still doesn't work, then try including all the lib* directory in ffmpeg directory in OpenCV-2.3.1/CMakeLists.txt, in the library path line, then remove build directory, create new one, and rerun cmake).

Hope this will help someone. It is very convoluted that ffmpeg 0.8.x won't work, and you're supposed to get 0.7.x.

Cheers,
MZ

Revision history for this message
vivek mittal (viv-mttl) said :
#8

thnx MZ

On Mon, Feb 20, 2012 at 6:00 AM, MZ <email address hidden>wrote:

> Your question #186872 on opencv in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/opencv/+question/186872
>
> MZ posted a new comment:
> I was able to resolve the same problem and got OpenCV successfully
> installed today.
>
> The problem was that OpenCV 2.3.1 isn't compatible with ffmpeg 0.8.x on
> Ubuntu 11.10 for some reason, so I downloaded ffmpeg 0.7.11, and then
> sudo apt-get remove ffmpeg x264, and reinstalled ffmpeg and x264. I also
> used the --enable-pic and --enable-shared flags for both, seeing on
> other posts that some people had problem when these aren't set.
>
> Then I removed the original build directory I created in the OpenCV
> directory, recreated a new build directory, because some of the previous
> builds interfere with cmake, that later cmakes doesn't look at the libs
> it found in previous builds, like ffmpeg, so it doesn't know that you
> reinstalled a new version. (I ran it many times with failures before I
> saw that and deleted the whole build directory and restarted a new one).
>
> In the new build directory, I reran cmake, now it saw the new ffmpeg,
> and then ran make, and it just ran all the way to 100%.
>
> (If it still doesn't work, then try including all the lib* directory in
> ffmpeg directory in OpenCV-2.3.1/CMakeLists.txt, in the library path
> line, then remove build directory, create new one, and rerun cmake).
>
> Hope this will help someone. It is very convoluted that ffmpeg 0.8.x
> won't work, and you're supposed to get 0.7.x.
>
> Cheers,
> MZ
>
> --
> You received this question notification because you asked the question.
>

Revision history for this message
vivek mittal (viv-mttl) said :
#9

LinkedIn
------------

I'd like to add you to my professional network on LinkedIn.

- Vivek

Vivek Mittal
Student at maheshwari public school
Ajmer Area, India

Confirm that you know Vivek Mittal:
https://www.linkedin.com/e/-m4n6ao-h4d23wze-7/isd/7770980371/rNfyVEjK/?hs=false&tok=3gwHA3Q0hOdlk1

--
You are receiving Invitation to Connect emails. Click to unsubscribe:
http://www.linkedin.com/e/-m4n6ao-h4d23wze-7/uKA78ph482_q9jb3IQ2S-mhDhZD_0d-TUs6ehoGmjvcv99bedtzEWK/goo/question186872%40answers%2Elaunchpad%2Enet/20061/I2627196445_1/?hs=false&tok=3BYwGM9KdOdlk1

(c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.