繁体   English   中英

在 Raspberry Pi 2 上编译 OpenCV

[英]Compiling OpenCV on Raspberry Pi 2

我正在 Raspberry 2 上编译 OpenCV,但在这一步卡住了,

[ 18%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o

返回了很多错误,我只取了{ CODEC_ID_H264, MKTAG('h', '2', '6', '4') }, 2 个,其他的在{ CODEC_ID_H264, MKTAG('h', '2', '6', '4') },上看起来相同但不同{ CODEC_ID_H264, MKTAG('h', '2', '6', '4') },

In file included from /home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:60:0,
                 from /home/pi/opencv/modules/highgui/src/cap_ffmpeg.cpp:45:
/home/pi/opencv/modules/highgui/src/ffmpeg_codecs.hpp:104:7: error: 'CODEC_ID_H264' was not     declared in this scope
     { CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
       ^
/home/pi/opencv/modules/highgui/src/ffmpeg_codecs.hpp:105:7: error: 'CODEC_ID_H264' was not     declared in this scope
     { CODEC_ID_H264, MKTAG('h', '2', '6', '4') },
       ^

最后一部分是关于

/home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'double     CvCapture_FFMPEG::get_fps()':
/home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:821:49: error: 'AVStream' has no member named 'r_frame_rate'
     double fps = r2d(ic->streams[video_stream]->r_frame_rate);
                                             ^
In file included from /home/pi/opencv/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp: In function 'int         icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)':
/home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:1237:72: error: 'avcodec_encode_video'     was not declared in this scope
         out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
                                                                    ^
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:215: recipe for target     'modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o' failed
make[2]: ** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o] Error 1
CMakeFiles/Makefile2:1823: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all'     failed
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
Makefile:137: recipe for target 'all' failed

请帮我解决这个问题,因为我尝试了几次后被困了很长时间,谢谢

此错误可能是由于您使用的是存储库中的ffmpeg 从源代码构建 OpenCV 时,强烈建议也构建相应的ffmpeg版本。 从您的 Pi 中删除任何ffmpegx264安装,然后进行构建。

在此处查看本指南以获取更多信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM