0

我想安装 OpenCV 2.1.0(在 Ubuntu 11.10 上),但是在 make 之后(我在 make 之前的步骤:http: //www.doc.ic.ac.uk/~strasdat/rss2010videos/INSTALL.txt)我得到:

[ 45%] Built target opencv_lapack
[ 45%] Built target cxcore_pch_dephelp
[ 45%] Built target pch_Generate_cxcore
[ 45%] Built target flann
[ 47%] Built target zlib
[ 50%] Built target cxcore
[ 50%] Built target cv_pch_dephelp
[ 51%] Built target pch_Generate_cv
[ 61%] Built target cv
[ 61%] Built target highgui_pch_dephelp
[ 61%] Built target pch_Generate_highgui
[ 61%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual void CvCapture_FFMPEG::close()’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:403:9: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1687) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:403:31: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1687) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘bool CvCapture_FFMPEG::reopen()’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:432:5: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1687) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:432:27: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1687) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:435:52: error: ‘av_open_input_file’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:436:5: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1511) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:436:27: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1511) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:443:5: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:443:28: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::open(const char*)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:468:63: error: ‘av_open_input_file’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:473:11: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1511) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:473:33: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1511) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:488:13: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:488:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::grabFrame()’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:566:54: error: ‘avcodec_decode_video’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘const char* icvFFMPEGErrStr(int)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:819:10: error: ‘AVERROR_NUMEXPECTED’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:823:10: error: ‘AVERROR_NOFMT’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:825:10: error: ‘AVERROR_IO’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:827:10: error: ‘AVERROR_NOMEM’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, AVCodecID, int, int, int, double, int)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:899:7: warning: ‘AVStream* av_new_stream(AVFormatContext*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1711) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:899:26: warning: ‘AVStream* av_new_stream(AVFormatContext*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1711) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1011:22: error: ‘PKT_FLAG_KEY’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1019:20: warning: ‘int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4388) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1019:72: warning: ‘int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4388) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1031:30: error: ‘PKT_FLAG_KEY’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual void CvVideoWriter_FFMPEG::close()’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1195:20: error: ‘url_fclose’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvVideoWriter_FFMPEG::open(const char*, int, double, CvSize, bool)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1228:41: error: ‘guess_format’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1251:31: error: ‘av_alloc_format_context’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1292:35: error: ‘av_set_parameters’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1296:35: error: ‘dump_format’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1321:15: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1321:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1358:42: error: ‘URL_WRONLY’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1358:52: error: ‘url_fopen’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1364:25: error: ‘av_write_header’ was not declared in this scope
make[2]: *** [src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o] Chyba 1
make[1]: *** [src/highgui/CMakeFiles/highgui.dir/all] Chyba 2
make: *** [all] Chyba 2

我在 cvcap_ffmpeg.cpp 文件中添加了这个:

#ifndef UINT64_C
#define UINT64_C(c) (c ## ULL)
#endif

#if LIBAVCODEC_VERSION_MAJOR < 53
#define CodecType AVMediaType

#define CODEC_TYPE_UNKNOWN    AVMEDIA_TYPE_UNKNOWN
#define CODEC_TYPE_VIDEO      AVMEDIA_TYPE_VIDEO
#define CODEC_TYPE_AUDIO      AVMEDIA_TYPE_AUDIO
#define CODEC_TYPE_DATA       AVMEDIA_TYPE_DATA
#define CODEC_TYPE_SUBTITLE   AVMEDIA_TYPE_SUBTITLE
#define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT
#define CODEC_TYPE_NB         AVMEDIA_TYPE_NB
#endif 

它解决了之前的一些问题。

我尝试像这里一样安装 ffmpeg -> https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide,但它没有改变。有人可以帮我解决这些错误吗?

感谢

4

1 回答 1

0

我从 https://code.ros.org/trac/opencv/ticket/1020得到了答案 试试这两个补丁

于 2013-03-22T13:52:29.800 回答