-1

I want to install openCV in my ubuntu 12.04 but I get this following error.

[ 45%] Building CXX object src/cxcore/CMakeFiles/cxcore_pch_dephelp.dir/cxcore_pch_dephelp.o
In file included from /home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxcore.h:1826:0,
from /home/michael/Downloads/open cv/OpenCV-2.1.0/src/cxcore/_cxcore.h:51,
from /home/michael/Downloads/open cv/OpenCV-2.1.0/release/src/cxcore/cxcore_pch_dephelp.cxx:1:
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxcore.hpp:177:13: error: ‘ptrdiff_t’ does not name a type
In file included from /home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxcore.hpp:2307:0,
from /home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxcore.h:1826,
from /home/michael/Downloads/open cv/OpenCV-2.1.0/src/cxcore/_cxcore.h:51,
from /home/michael/Downloads/open cv/OpenCV-2.1.0/release/src/cxcore/cxcore_pch_dephelp.cxx:1:
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxoperations.hpp:2043:15: error: ‘ptrdiff_t’ does not name a type
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxoperations.hpp:2591:31: error: ‘ptrdiff_t’ does not name a type
In file included from /home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxcore.hpp:2308:0,
from /home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxcore.h:1826,
from /home/michael/Downloads/open cv/OpenCV-2.1.0/src/cxcore/_cxcore.h:51,
from /home/michael/Downloads/open cv/OpenCV-2.1.0/release/src/cxcore/cxcore_pch_dephelp.cxx:1:
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp: In member function ‘void cv::Mat::locateROI(cv::Size&, cv::Point&) const’:
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:387:5: error: ‘ptrdiff_t’ was not declared in this scope
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:387:5: note: suggested alternatives:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/i686-pc-linux-gnu/bits/c++config.h:156:28: note: ‘std::ptrdiff_t’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/i686-pc-linux-gnu/bits/c++config.h:156:28: note: ‘std::ptrdiff_t’
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:387:15: error: expected ‘;’ before ‘delta1’
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:389:9: error: ‘delta1’ was not declared in this scope
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:398:31: error: ‘delta2’ was not declared in this scope
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp: In member function ‘cv::Point cv::MatConstIterator_::pos() const’:
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:3459:9: error: ‘ptrdiff_t’ was not declared in this scope
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:3459:9: note: suggested alternatives:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/i686-pc-linux-gnu/bits/c++config.h:156:28: note: ‘std::ptrdiff_t’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/i686-pc-linux-gnu/bits/c++config.h:156:28: note: ‘std::ptrdiff_t’
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:3459:19: error: expected ‘;’ before ‘ofs’
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:3460:23: error: ‘ofs’ was not declared in this scope
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:3460:66: error: expected ‘)’ before ‘y’
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:3465:9: error: ‘ptrdiff_t’ was not declared in this scope
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:3465:9: note: suggested alternatives:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/i686-pc-linux-gnu/bits/c++config.h:156:28: note: ‘std::ptrdiff_t’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/i686-pc-linux-gnu/bits/c++config.h:156:28: note: ‘std::ptrdiff_t’
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:3465:19: error: expected ‘;’ before ‘ofs’
/home/michael/Downloads/open cv/OpenCV-2.1.0/include/opencv/cxmat.hpp:3466:23: error: ‘ofs’ was not declared in this scope
make[2]: *** [src/cxcore/CMakeFiles/cxcore_pch_dephelp.dir/cxcore_pch_dephelp.o] Error 1
make[1]: *** [src/cxcore/CMakeFiles/cxcore_pch_dephelp.dir/all] Error 2
make: *** [all] Error 2

I have tried adding #include <stddef.h> in cxcore.hpp, but then I get this error

[ 45%] Built target opencv_lapack
[ 45%] Building CXX object src/cxcore/CMakeFiles/cxcore_pch_dephelp.dir/cxcore_pch_dephelp.o
Linking CXX static library ../../lib/libcxcore_pch_dephelp.a
[ 45%] Built target cxcore_pch_dephelp
Scanning dependencies of target pch_Generate_cxcore
[ 45%] Generating _cxcore.h
[ 45%] Generating _cxcore.h.gch/cxcore_RELEASE.gch
c++: error: cv/OpenCV-2.1.0/.: No such file or directory
c++: error: cv/OpenCV-2.1.0/release: No such file or directory
c++: error: cv/OpenCV-2.1.0/include: No such file or directory
c++: error: cv/OpenCV-2.1.0/include/opencv: No such file or directory
c++: error: cv/OpenCV-2.1.0/src/cxcore/../../3rdparty/include: No such file or directory
c++: error: cv/OpenCV-2.1.0/src/cxcore/../../include/opencv: No such file or directory
c++: error: cv/OpenCV-2.1.0/release/src/cxcore: No such file or directory
make[2]: *** [src/cxcore/_cxcore.h.gch/cxcore_RELEASE.gch] Error 1
make[1]: *** [src/cxcore/CMakeFiles/pch_Generate_cxcore.dir/all] Error 2
make: *** [all] Error 2

How to fix this problem? Is it impossible to install this version of openCV in ubuntu 12.04. Any help will be appreciated. :)

According to @steeldriver comment, I have renamed the folder and it works. But I got another error. I use 32 bit Ubuntu 12.04. These are the errors.

[ 61%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o
In file included from /usr/include/libavutil/avutil.h:318:0,
             from /usr/include/libavutil/samplefmt.h:22,
             from /usr/include/libavcodec/avcodec.h:30,
             from /usr/include/libavformat/avformat.h:140,
             from /home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:97:
/usr/include/libavutil/common.h: In function ‘int32_t av_clipl_int32_c(int64_t)’:
/usr/include/libavutil/common.h:168:47: error: ‘UINT64_C’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual void CvCapture_FFMPEG::close()’:
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:385:9: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1580) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:385:31: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1580) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘bool CvCapture_FFMPEG::reopen()’:
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:414:5: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1580) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:414:27: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1580) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:417:5: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1368) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:417:52: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1368) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:418:5: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1412) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:418:27: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1412) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:425:5: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4035) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:425:28: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4035) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::open(const char*)’:
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:450:15: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1368) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:450:63: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1368) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:455:11: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1412) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:455:33: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1412) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:467:13: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:470:13: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4035) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:470:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4035) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::grabFrame()’:
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:548:54: error: ‘avcodec_decode_video’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘const char* icvFFMPEGErrStr(int)’:
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:801:10: error: ‘AVERROR_NUMEXPECTED’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:805:10: error: ‘AVERROR_NOFMT’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:807:10: error: ‘AVERROR_IO’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:809:10: error: ‘AVERROR_NOMEM’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, CodecID, int, int, int, double, int)’:
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:881:7: warning: ‘AVStream* av_new_stream(AVFormatContext*, int)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1604) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:881:26: warning: ‘AVStream* av_new_stream(AVFormatContext*, int)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1604) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:894:70: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’:
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:993:22: error: ‘PKT_FLAG_KEY’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1008:90: error: ‘av_rescale_q’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1013:30: error: ‘PKT_FLAG_KEY’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual void CvVideoWriter_FFMPEG::close()’:
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1177:3: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/include/libavformat/avio.h:317) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1177:20: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/include/libavformat/avio.h:317) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvVideoWriter_FFMPEG::open(const char*, int, double, CvSize, bool)’:
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1210:41: error: ‘guess_format’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1233:31: error: ‘av_alloc_format_context’ was not declared in this scope
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1274:9: warning: ‘int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1640) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1274:35: warning: ‘int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1640) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1278:5: warning: ‘void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1902) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1278:35: warning: ‘void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1902) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1303:15: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4035) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1303:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4035) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1340:13: warning: ‘int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avio.h:316) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1340:52: warning: ‘int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avio.h:316) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1346:5: warning: ‘int av_write_header(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1676) [-Wdeprecated-declarations]
/home/michael/Downloads/opencv/OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1346:25: warning: ‘int av_write_header(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1676) [-Wdeprecated-declarations]
make[2]: *** [src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o] Error 1
make[1]: *** [src/highgui/CMakeFiles/highgui.dir/all] Error 2
make: *** [all] Error 2

I have tried including <stdint.h> in common.h file, but still not working. Or maybe I did it wrong when including <stdint.h> file? Please help.

This is the make result after running cmake -DWITH_FFMPEG=OFF

[ 81%] Building CXX object apps/haartraining/CMakeFiles/createsamples.dir/createsamples.o
Linking CXX executable ../../bin/opencv_createsamples
../../lib/libhighgui.so.2.1.0: undefined reference to `cvCreateCameraCapture_V4L(int)'
collect2: ld returned 1 exit status
make[2]: *** [bin/opencv_createsamples] Error 1
make[1]: *** [apps/haartraining/CMakeFiles/createsamples.dir/all] Error 2
make: *** [all] Error 2

Why is that?

7
  • No it is not impossible to build opencv-2.1.0 on 12.04 - your second set of errors are almost certainly due to having a space in your directory path (try renaming ~/Downloads/open cv/ to ~/Downloads/opencv/ for example). Please also add the target architecture to your question (32 bit or 64 bit - there are some additional include fixes that seem to be necessary on x86_64). Dec 27, 2013 at 3:11
  • @steeldriver I have tried your comment and edited my question. There is another error. Could you help me?
    – micmec
    Dec 27, 2013 at 13:36
  • I have a previously generated patch that allowed me to compile this - let me just check it works on a fresh copy and get back to you Dec 27, 2013 at 14:06
  • OK I checked my patch and it does not fix the ffmpeg build problems - if you don't actually need ffmpeg functionality, then the easiest workaround is simply to disable ffmpeg component by running cmake -DWITH_FFMPEG=OFF and then trying the make step again. If you do need ffmpeg support then post back and I will look into that some more. Dec 27, 2013 at 14:30
  • I think I would need ffmpeg, but when I try running with cmake -DWITH_FFMPEG=OFF it gives some error. Please see my edited question.
    – micmec
    Dec 27, 2013 at 16:52

2 Answers 2

0

If you don't need ffmpeg functionality, then it should be possible to build the remaining components of OpenCV-2.1.0 on Ubuntu 12.04 using this patch [dropbox.com]. To apply the patch, copy it to the same level as the unpacked OpenCV-2.1.0 directory, and then

cd OpenCV-2.1.0/
patch -p1 < ../patch-OpenCV-2.1.0-all.txt

after which it should be possible to configure and make the remaining components using

cmake -DWITH_FFMPEG=OFF .
make

I have tested it on 32-bit 12.04.3 with gcc-4.6.3 and (iirc) on a 64-bit crunchbang system with gcc-4.7 (in fact some of the changes in the patch are likely only needed for gcc >= 4.7). The files affected by the patch are

OpenCV-2.1.0/cvconfig.h.cmake
OpenCV-2.1.0/include/opencv/cxcore.h
OpenCV-2.1.0/src/highgui/cvcap.cpp
OpenCV-2.1.0/src/highgui/cvcap_libv4l.cpp
OpenCV-2.1.0/src/highgui/_highgui.h
OpenCV-2.1.0/tests/cv/src/anearestneighbors.cpp
OpenCV-2.1.0/tests/cxcore/src/aio.cpp
OpenCV-2.1.0/tests/ml/src/slmltests.cpp

Unfortunately there seem to be a number of complicated co-dependencies between ffmpeg and libav that make patching of that component rather more difficult.

7
  • It works! Thanks a lot. Now my question is how to check whether the OpenCV is installed or not? And how to check what version it is? By the way what is the difference between using ffmpeg and not to use one?
    – micmec
    Dec 27, 2013 at 19:40
  • OK so far so good - until you execute a make install, the OpenCV-2.1.0 libraries will only be available locally (in OpenCV-2.1.0/lib - with header files in OpenCV-2.1.0/include). Depending what permissions you have on the system and what application you are trying to build with OpenCV, that may be sufficicent, otherwise you will probably want to make install which will put the necessary files into /usr/local where pkg-config will find them by default. [At least I think /usr/local is the default location - you may want to check by running cmake -LAH . | grep CMAKE_INSTALL_PREFIX] Dec 27, 2013 at 20:40
  • How to check the version of the OpenCV? What is the difference between using ffmpeg and not?
    – micmec
    Dec 27, 2013 at 22:42
  • You can check what version pkg-config thinks you have using pkg-config --modversion opencv - that's usually what matters since you would typically use pkg-config to automate the includes and libs when you build your app. The ffmpeg library is used for things like streaming and codec conversions - if your app is performing static image processing (edge / object detection for example) then you likely won't need it. Dec 27, 2013 at 23:09
  • If I tried detecting moving object, does it mean I'm performing static image processing? How to add ffmpeg to the OpenCV when I've installed it without one?
    – micmec
    Dec 28, 2013 at 0:41
0

try reinstalling

$cd ~/opencv2.4.5

$mkdir build

$cd build

$cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON

NOw,you should use super user or sudo

$make

$sudo make install

at last,test whether the installation was successful

$cd ~/opencv2.4.5/samples/c

$g++ `pkg-config --cflags opencv` -o mydelaunay delaunay.c `pkg-config --libs opencv`
1
  • I have done it from the start, but when doing make, it gives me error.
    – micmec
    Dec 27, 2013 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .