簡體   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