在Raspberry Pi 2上编译OpenCV

时间:2016-04-21 20:24:43

标签: c++ opencv raspberry-pi raspberry-pi2

我正在Raspberry 2上编译OpenCV 我被困在这一步,

[ 18%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o
返回了很多错误,我只拿了2个开头,其他看起来都一样 但在{ 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

请耐心等待我这么做几次,经过几次尝试后,我会被困在这里,谢谢

1 个答案:

答案 0 :(得分:1)

此错误可能是由于您使用了存储库中的private function userExist($username){ $con = new PDO('pgsql:host=xx.xxx.xxx;dbname=support_tool','xx','xxx'); $sql = 'SELECT username FROM tbl_user WHERE username =\''.$username.'\''; $stmt = $con->prepare($sql); $stmt->execute(); //$result = $stmt->fetchAll(PDO::FETCH_ASSOC); $result = $stmt->fetchAll(); if(!empty($result)){ return true; }else{ return false; } 这一事实。从源代码构建OpenCV时,强烈建议同时构建相应的ffmpeg版本。从Pi中删除ffmpegffmpeg的所有安装,然后进行构建。

查看this guide here了解详情。