1)linux查看opencv安裝路徑及版本號
查看linux下的opencv安裝庫:
pkg-config opencv --libs
查看linux下的opencv安裝版本:
pkg-config opencv --modversion
查看linux下的opencv安裝路徑:
find / -iname "*opencv*"
2)編譯指令
創(chuàng)建庫目錄: ?? mkdir install
創(chuàng)建生成目錄 : ? mkdir build
進入目錄: cd build
執(zhí)行生成Makefile:
cmake -D WITH_CUDA=OFF \
?? -D CMAKE_BUILD_TYPE=Release \
?? -D CMAKE_INSTALL_PREFIX=cmake -D WITH_CUDA=OFF \
?? -D CMAKE_BUILD_TYPE=Release \
?? -D CMAKE_INSTALL_PREFIX=/home/packages/opencv/install \
?? -D WITH_IPP=OFF \
?? -D WITH_FFMPEG=ON? \
?? -D BUILD_TESTS=OFF \
?? -D BUILD_PERF_TESTS=OFF \
?? -D INSTALL_PYTHON_EXAMPLES=OFF \
?? -D INSTALL_C_EXAMPLES=OFF \
?? -D PYTHON_EXECUTABLE=$(which python) \
?? -D BUILD_EXAMPLES=OFF .. \
?? -D WITH_IPP=OFF \
?? -D WITH_FFMPEG=ON? \
?? -D BUILD_TESTS=OFF \
?? -D BUILD_PERF_TESTS=OFF \
?? -D INSTALL_PYTHON_EXAMPLES=OFF \
?? -D INSTALL_C_EXAMPLES=OFF \
?? -D PYTHON_EXECUTABLE=$(which python) \
?? -D BUILD_EXAMPLES=OFF ..
生成安裝:make && make install
編譯異常
1)[ 98%] Linking CXX executable ../../bin/opencv_performance
../../lib/libopencv_highgui.so.2.4.9: undefined reference to `avcodec_alloc_frame'
../../lib/libopencv_highgui.so.2.4.9: undefined reference to `avcodec_encode_video'
collect2: error: ld returned 1 exit status
apps/haartraining/CMakeFiles/opencv_performance.dir/build.make:105: recipe for target 'bin/opencv_performance' failed
make[2]: *** [bin/opencv_performance] Error 1
CMakeFiles/Makefile2:3388: recipe for target 'apps/haartraining/CMakeFiles/opencv_performance.dir/all' failed
make[1]: *** [apps/haartraining/CMakeFiles/opencv_performance.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
問題:undefined reference to `avcodec_alloc_frame'
通過grep -r?"avcodec_alloc_frame"? / 查詢?nèi)治谋痉祷乜?/p>
最新版本的FFmpeg該函數(shù)的實現(xiàn)名稱已經(jīng)改變,下載ffmpeg-2.3.tar.bz2源碼編譯
2)已經(jīng)編譯ffmpeg-2.3.tar.bz2,生成libswresample.so.0無法找到,將libswresample.so.0拷貝到/lib64目錄下
/usr/bin/ld: warning: libswresample.so.0, needed by //home/dong/ffmpeg/ffmpeg-2.3/build/lib/libavcodec.so.55, not found (try using -rpath or -rpath-link)
//home/dong/ffmpeg/ffmpeg-2.3/build/lib/libavcodec.so.55: undefined reference to `swr_init@LIBSWRESAMPLE_0'
//home/dong/ffmpeg/ffmpeg-2.3/build/lib/libavcodec.so.55: undefined reference to `swr_close@LIBSWRESAMPLE_0'
//home/dong/ffmpeg/ffmpeg-2.3/build/lib/libavcodec.so.55: undefined reference to `swr_is_initialized@LIBSWRESAMPLE_0'
//home/dong/ffmpeg/ffmpeg-2.3/build/lib/libavcodec.so.55: undefined reference to `swr_free@LIBSWRESAMPLE_0'
//home/dong/ffmpeg/ffmpeg-2.3/build/lib/libavcodec.so.55: undefined reference to `swr_alloc@LIBSWRESAMPLE_0'
//home/dong/ffmpeg/ffmpeg-2.3/build/lib/libavcodec.so.55: undefined reference to `swr_convert@LIBSWRESAMPLE_0'
collect2: error: ld returned 1 exit status
apps/haartraining/CMakeFiles/opencv_performance.dir/build.make:105: recipe for target 'bin/opencv_performance' failed
make[2]: *** [bin/opencv_performance] Error 1
CMakeFiles/Makefile2:3388: recipe for target 'apps/haartraining/CMakeFiles/opencv_performance.dir/all' failed
make[1]: *** [apps/haartraining/CMakeFiles/opencv_performance.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error
3)export PKG_CONFIG_PATH=/home/dong/opencv-2.4.9/install/lib/pkgconfig/;$PKG_CONFIG_PATH
指定OpenCV優(yōu)先查找編譯好的FFmpeg,而不是系統(tǒng)的FFmpeg庫
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
文章標題:OpenCV2.4.9版本編譯-創(chuàng)新互聯(lián)
當前地址:http://muchs.cn/article24/pgjje.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、關鍵詞優(yōu)化、虛擬主機、網(wǎng)站導航、手機網(wǎng)站建設、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容