1)linux查看opencv安裝路徑及版本號(hào)
查看linux下的opencv安裝庫(kù):
pkg-config opencv --libs
查看linux下的opencv安裝版本:
pkg-config opencv --modversion
查看linux下的opencv安裝路徑:
find / -iname "*opencv*"
2)編譯指令
創(chuàng)建庫(kù)目錄: ?? mkdir install
創(chuàng)建生成目錄 : ? mkdir build
進(jìn)入目錄: 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
問(wèn)題:undefined reference to `avcodec_alloc_frame'
通過(guò)grep -r?"avcodec_alloc_frame"? / 查詢?nèi)治谋痉祷乜?/p>
最新版本的FFmpeg該函數(shù)的實(shí)現(xiàn)名稱已經(jīng)改變,下載ffmpeg-2.3.tar.bz2源碼編譯
2)已經(jīng)編譯ffmpeg-2.3.tar.bz2,生成libswresample.so.0無(wú)法找到,將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庫(kù)
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
文章標(biāo)題:OpenCV2.4.9版本編譯-創(chuàng)新互聯(lián)
當(dāng)前地址:http://aaarwkj.com/article24/pgjje.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、關(guān)鍵詞優(yōu)化、虛擬主機(jī)、網(wǎng)站導(dǎo)航、手機(jī)網(wǎng)站建設(shè)、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容