編譯opencv程式的指令碼

2021-05-26 08:39:43 字數 1192 閱讀 6136

#!/bin/sh

#compile the project

#the project path

pd=.

#the project name

echo "please input the project name:"

read pn

#pn=facelib

x=1while [ $x -le 5 ]; do

echo "$x" >txt.txt

x=$(($x+1))

done

#pn=`awk '' pname.txt `

cxx=gcc

cflags=-o

cv_inc=-i/usr/local/opencv/include/opencv

cv_libs=-l/usr/local/opencv/lib

cv_lib="-lcv -lhighgui -lcvaux -lml -lcxcore"

face_flags="-o2 -w -c "

face_inc=-i/opt/practise/source-c/facelib

face_libs=-l/opt/practise/source-c/facelib

face_lib="-lfacelib"

flags="-o0 -g3 -w -fmessage-length=01"

#flags="-o0 -g3 -w -c -fmessage-length=01"

#flags="-w"

#rm="rm -f"

#cd $pd/$pn

#$cxx  $cv_libs $cv_inc $cv_lib $pn$c_source $cflags $pn

if [ "$pn"x = "facelib"x ]; then

#echo "facelib"

$cxx  $cv_libs $cv_inc $cv_lib $flags **.c $face_flags

ar crv libfacelib.a **.o

else

$cxx  $cv_libs $cv_inc $cv_lib $face_libs $face_inc $face_lib $flags $pn.c $cflags $pn

#echo "other project"

fi#time ./$pn

#$cv_libs  $libs

shell指令碼或命令編譯opencv程式

通常使用opencv編寫好 之後要進行編譯有時候比較麻煩,可以寫乙個shell指令碼來解決。建立乙個h.sh,用來幫助編譯 bin bash infile 1 outfile 2 g pkg config cflags opencv g infile pkg config libs opencv o...

Mac Linux編譯OpenCV程式

在編譯opencv程式之前,先看一下普通的c 程式如何編譯,假設main.cpp有如下 最終結果是列印hello world,include using namespace std int main int argc,const char argv 在命令列中只要輸入以下命令就可以看到輸出hello...

採用gcc編譯opencv程式

那麼採用gcc g 手動編譯程式也是相當容易的。在系統安裝了opencv的情況下 opencv2.4,預設安裝,安裝在usr local lib usr local include 採用下面的命令編譯 g o test test.cpp i usr local include i usr local...