Eu quero instalar o openCV no meu Ubuntu 12.04, mas recebo o seguinte erro.
[ 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
Eu tentei adicionar #include <stddef.h>
em cxcore.hpp, mas depois recebi esse erro
[ 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
Como corrigir esse problema? É impossível instalar esta versão do openCV no Ubuntu 12.04. Qualquer ajuda será apreciada.
:)
De acordo com o comentário @steeldriver, renomei a pasta e ela funciona. Mas eu tenho outro erro. Eu uso o Ubuntu 12 bits de 32 bits. Estes são os erros.
[ 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
Eu tentei incluir <stdint.h>
no arquivo common.h, mas ainda não está funcionando. Ou talvez eu tenha feito errado ao incluir o arquivo <stdint.h>
? Por favor ajude.
Este é o resultado make
depois de executar 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
Por que isso?