ubuntu下安装opencv2.0时遇到下面问题,有人遇到类似问题有解决方法吗?
在编译opencv时遇到下面问题,终端make的提示是:
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:467:13: 错误: ‘CODEC_TYPE_VIDEO’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:548:54: 错误: ‘avcodec_decode_video’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: 在函数‘const char* icvFFMPEGErrStr(int)’中:
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:790:10: 错误: ‘AVERROR_NUMEXPECTED’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:794:10: 错误: ‘AVERROR_NOFMT’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:796:10: 错误: ‘AVERROR_IO’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:798:10: 错误: ‘AVERROR_NOMEM’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: 在函数‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, CodecID, int, int, int, double, int)’中:
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:883:70: 错误: ‘CODEC_TYPE_VIDEO’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: 在函数‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’中:
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:982:22: 错误: ‘PKT_FLAG_KEY’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1002:30: 错误: ‘PKT_FLAG_KEY’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1199:41: 错误: ‘guess_format’在此作用域中尚未声明
/usr/local/OpenCV/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1213:31: 错误: ‘av_alloc_format_context’在此作用域中尚未声明
这些东西都没声明,我该怎样声明呢?求大神解答!
------解决方案--------------------真巧 我也今天装opencv2.1遇到同样的问题
这是由于ffmpeg版本太高,与opencv2.1不兼容
以前装过opencv2.3 没又出现这个问题
下面网页提供了解决方法
https://code.ros.org/trac/opencv/ticket/1020